Remove path argument from cmd_execute()
It is always equal to argv[0] (or not used on Windows).
This commit is contained in:
parent
8dc11a0286
commit
73e8ec1b35
4 changed files with 5 additions and 6 deletions
|
@ -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 *));
|
memcpy(&cmd[i], adb_cmd, len * sizeof(const char *));
|
||||||
cmd[len + i] = NULL;
|
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) {
|
if (r != PROCESS_SUCCESS) {
|
||||||
show_adb_err_msg(r, cmd);
|
show_adb_err_msg(r, cmd);
|
||||||
return PROCESS_NONE;
|
return PROCESS_NONE;
|
||||||
|
|
|
@ -44,7 +44,7 @@ enum process_result {
|
||||||
};
|
};
|
||||||
|
|
||||||
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
|
bool
|
||||||
cmd_terminate(process_t pid);
|
cmd_terminate(process_t pid);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
enum process_result
|
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];
|
int fd[2];
|
||||||
|
|
||||||
if (pipe(fd) == -1) {
|
if (pipe(fd) == -1) {
|
||||||
|
@ -52,7 +52,7 @@ cmd_execute(const char *path, const char *const argv[], pid_t *pid) {
|
||||||
// child close read side
|
// child close read side
|
||||||
close(fd[0]);
|
close(fd[0]);
|
||||||
if (fcntl(fd[1], F_SETFD, FD_CLOEXEC) == 0) {
|
if (fcntl(fd[1], F_SETFD, FD_CLOEXEC) == 0) {
|
||||||
execvp(path, (char *const *)argv);
|
execvp(argv[0], (char *const *)argv);
|
||||||
if (errno == ENOENT) {
|
if (errno == ENOENT) {
|
||||||
ret = PROCESS_ERROR_MISSING_BINARY;
|
ret = PROCESS_ERROR_MISSING_BINARY;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -19,8 +19,7 @@ build_cmd(char *cmd, size_t len, const char *const argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
enum process_result
|
enum process_result
|
||||||
cmd_execute(const char *path, const char *const argv[], HANDLE *handle) {
|
cmd_execute(const char *const argv[], HANDLE *handle) {
|
||||||
(void) path;
|
|
||||||
STARTUPINFOW si;
|
STARTUPINFOW si;
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
memset(&si, 0, sizeof(si));
|
memset(&si, 0, sizeof(si));
|
||||||
|
|
Loading…
Reference in a new issue