Skip to content

Display and control your Android device

Remove path argument from cmd_execute()

Romain Vimont73e8ec1b356e
diff --git a/app/src/command.c b/app/src/command.c
index 33a9c587..abaa223d 100644
--- a/app/src/command.c
+++ b/app/src/command.c
@@ -91,7 +91,7 @@ adb_execute(const char *serial, const char *const adb_cmd[], size_t len) {
memcpy(&cmd[i], adb_cmd, len * sizeof(const char *));
cmd[len + i] = NULL;
- enum process_result r = cmd_execute(cmd[0], cmd, &process);
+ enum process_result r = cmd_execute(cmd, &process);
if (r != PROCESS_SUCCESS) {
show_adb_err_msg(r, cmd);
return PROCESS_NONE;
diff --git a/app/src/command.h b/app/src/command.h
index e748c1c5..edbc3fb8 100644
--- a/app/src/command.h
+++ b/app/src/command.h
@@ -44,7 +44,7 @@ enum process_result {
};
enum process_result
-cmd_execute(const char *path, const char *const argv[], process_t *process);
+cmd_execute(const char *const argv[], process_t *process);
bool
cmd_terminate(process_t pid);
diff --git a/app/src/sys/unix/command.c b/app/src/sys/unix/command.c
index 512b9af7..fbcf2355 100644
--- a/app/src/sys/unix/command.c
+++ b/app/src/sys/unix/command.c
@@ -21,7 +21,7 @@
#include "util/log.h"
enum process_result
-cmd_execute(const char *path, const char *const argv[], pid_t *pid) {
+cmd_execute(const char *const argv[], pid_t *pid) {
int fd[2];
if (pipe(fd) == -1) {
@@ -52,7 +52,7 @@ cmd_execute(const char *path, const char *const argv[], pid_t *pid) {
// child close read side
close(fd[0]);
if (fcntl(fd[1], F_SETFD, FD_CLOEXEC) == 0) {
- execvp(path, (char *const *)argv);
+ execvp(argv[0], (char *const *)argv);
if (errno == ENOENT) {
ret = PROCESS_ERROR_MISSING_BINARY;
} else {
diff --git a/app/src/sys/win/command.c b/app/src/sys/win/command.c
index 6cd0e944..55edaf8f 100644
--- a/app/src/sys/win/command.c
+++ b/app/src/sys/win/command.c
@@ -19,8 +19,7 @@ build_cmd(char *cmd, size_t len, const char *const argv[]) {
}
enum process_result
-cmd_execute(const char *path, const char *const argv[], HANDLE *handle) {
- (void) path;
+cmd_execute(const char *const argv[], HANDLE *handle) {
STARTUPINFOW si;
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));