diff options
-rw-r--r-- | src/shared/util.c | 40 | ||||
-rw-r--r-- | src/shared/util.h | 2 |
2 files changed, 0 insertions, 42 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index 156f483826..ac69ae80e2 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -62,7 +62,6 @@ #include "strv.h" #include "mkdir.h" #include "path-util.h" -#include "exit-status.h" #include "hashmap.h" #include "fileio.h" #include "utf8.h" @@ -1960,45 +1959,6 @@ finish: return 1; } -int execute_command(const char *command, char *const argv[]) { - - pid_t pid; - int status; - - if ((status = access(command, X_OK)) != 0) - return status; - - if ((pid = fork()) < 0) { - log_error_errno(errno, "Failed to fork: %m"); - return pid; - } - - if (pid == 0) { - - execvp(command, argv); - - log_error_errno(errno, "Failed to execute %s: %m", command); - _exit(EXIT_FAILURE); - } - else while (1) - { - siginfo_t si; - - int r = waitid(P_PID, pid, &si, WEXITED); - - if (!is_clean_exit(si.si_code, si.si_status, NULL)) { - if (si.si_code == CLD_EXITED) - log_error("%s exited with exit status %i.", command, si.si_status); - else - log_error("%s terminated by signal %s.", command, signal_to_string(si.si_status)); - } else - log_debug("%s exited successfully.", command); - - return si.si_status; - - } -} - void cmsg_close_all(struct msghdr *mh) { struct cmsghdr *cmsg; diff --git a/src/shared/util.h b/src/shared/util.h index e9178b9bd3..5c1dc48019 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -420,8 +420,6 @@ typedef enum UnquoteFlags { int unquote_first_word(const char **p, char **ret, UnquoteFlags flags); -int execute_command(const char *command, char *const argv[]); - #define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1) #define FOREACH_INOTIFY_EVENT(e, buffer, sz) \ |