diff options
Diffstat (limited to 'miscutils/time.c')
-rw-r--r-- | miscutils/time.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/miscutils/time.c b/miscutils/time.c index 6946c863f..9facc3657 100644 --- a/miscutils/time.c +++ b/miscutils/time.c | |||
@@ -367,20 +367,15 @@ static void summarize(const char *fmt, char **command, resource_t *resp) | |||
367 | Put the statistics in *RESP. */ | 367 | Put the statistics in *RESP. */ |
368 | static void run_command(char *const *cmd, resource_t *resp) | 368 | static void run_command(char *const *cmd, resource_t *resp) |
369 | { | 369 | { |
370 | pid_t pid; /* Pid of child. */ | 370 | pid_t pid; |
371 | void (*interrupt_signal)(int); | 371 | void (*interrupt_signal)(int); |
372 | void (*quit_signal)(int); | 372 | void (*quit_signal)(int); |
373 | 373 | ||
374 | resp->elapsed_ms = monotonic_ms(); | 374 | resp->elapsed_ms = monotonic_ms(); |
375 | pid = vfork(); /* Run CMD as child process. */ | 375 | pid = xvfork(); |
376 | if (pid < 0) | 376 | if (pid == 0) { |
377 | bb_perror_msg_and_die("fork"); | 377 | /* Child */ |
378 | if (pid == 0) { /* If child. */ | 378 | BB_EXECVP_or_die((char**)cmd); |
379 | /* Don't cast execvp arguments; that causes errors on some systems, | ||
380 | versus merely warnings if the cast is left off. */ | ||
381 | BB_EXECVP(cmd[0], cmd); | ||
382 | xfunc_error_retval = (errno == ENOENT ? 127 : 126); | ||
383 | bb_error_msg_and_die("can't run '%s'", cmd[0]); | ||
384 | } | 379 | } |
385 | 380 | ||
386 | /* Have signals kill the child but not self (if possible). */ | 381 | /* Have signals kill the child but not self (if possible). */ |