diff options
| -rw-r--r-- | exec.c | 7 | ||||
| -rw-r--r-- | gui.c | 4 | ||||
| -rw-r--r-- | gui_theme.c | 2 | ||||
| -rw-r--r-- | mixer.c | 4 | ||||
| -rw-r--r-- | para.h | 2 |
5 files changed, 10 insertions, 9 deletions
@@ -18,7 +18,8 @@ static void xdup2(int oldfd, int newfd) } /* Spawn a new process, redirect fds, have the child call execvp(2). */ -static int para_exec(pid_t *pid, const char *file, char *const *const args, int *fds) +static int fork_and_exec(pid_t *pid, const char *file, + char *const *const args, int *fds) { int ret, in[2] = {-1, -1}, out[2] = {-1, -1}, err[2] = {-1, -1}, null = -1, control[2]; @@ -154,7 +155,7 @@ err_out: * * \sa \ref create_argv(), null(4), pipe(2), dup2(2), fork(2), exec(3). */ -int para_exec_cmdline_pid(pid_t *pid, const char *cmdline, int *fds) +int xexec(pid_t *pid, const char *cmdline, int *fds) { int ret; char **argv; @@ -163,7 +164,7 @@ int para_exec_cmdline_pid(pid_t *pid, const char *cmdline, int *fds) if (ret < 0) return ret; PARA_INFO_LOG("cmdline: %s\n", cmdline); - ret = para_exec(pid, argv[0], argv, fds); + ret = fork_and_exec(pid, argv[0], argv, fds); free_argv(argv); return ret; } @@ -1012,7 +1012,7 @@ static void exec_and_display(const char *file_and_args) int ret, fds[3] = {0, 1, 1}; outputf(COLOR_COMMAND, "%s", file_and_args); - ret = para_exec_cmdline_pid(&exec_pid, file_and_args, fds); + ret = xexec(&exec_pid, file_and_args, fds); if (ret < 0) return; ret = mark_fd_nonblocking(fds[1]); @@ -1046,7 +1046,7 @@ static void exec_external(char *file_and_args) if (exec_pid) return; shutdown_curses(); - para_exec_cmdline_pid(&exec_pid, file_and_args, fds); + xexec(&exec_pid, file_and_args, fds); } static void handle_command(int c) diff --git a/gui_theme.c b/gui_theme.c index d356837d..18d5522e 100644 --- a/gui_theme.c +++ b/gui_theme.c @@ -99,7 +99,7 @@ static int figlet_exec(const char *str, WINDOW *win) struct figlet_output figo = {.max_width = 0}; pid_t pid; - ret = para_exec_cmdline_pid(&pid, cmd, fds); + ret = xexec(&pid, cmd, fds); if (ret < 0) return ret; write_all(fds[0], str, strlen(str)); @@ -209,7 +209,7 @@ static void run(const char *exe, const char *cmd) char *cmdline = make_message("%s %s", exe, cmd); PARA_INFO_LOG("%s\n", cmdline); - ret = para_exec_cmdline_pid(&pid, cmdline, fds); + ret = xexec(&pid, cmdline, fds); free(cmdline); if (ret < 0) { PARA_ERROR_LOG("%s\n", para_strerror(-ret)); @@ -238,7 +238,7 @@ static char *get_status_item(const char *status_item_name) cmdline = make_message("para_audioc -- stat --one-shot %s", status_item_name); - ret = para_exec_cmdline_pid(&pid, cmdline, fds); + ret = xexec(&pid, cmdline, fds); free(cmdline); if (ret < 0) { PARA_ERROR_LOG("%s\n", para_strerror(-ret)); @@ -106,7 +106,7 @@ extern __printf_2_3 void (*para_log)(int, const char*, ...); #define AUTH_REQUEST_MSG "auth rsa " /* exec */ -int para_exec_cmdline_pid(pid_t *pid, const char *cmdline, int *fds); +int xexec(pid_t *pid, const char *cmdline, int *fds); /* time */ int tv_diff(const struct timeval *b, const struct timeval *a, |
