diff options
Diffstat (limited to 'miscutils/setsid.c')
-rw-r--r-- | miscutils/setsid.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/miscutils/setsid.c b/miscutils/setsid.c index 6db07be5f..c878f524b 100644 --- a/miscutils/setsid.c +++ b/miscutils/setsid.c | |||
@@ -22,21 +22,12 @@ int setsid_main(int argc, char *argv[]) | |||
22 | if (argc < 2) | 22 | if (argc < 2) |
23 | bb_show_usage(); | 23 | bb_show_usage(); |
24 | 24 | ||
25 | if (getpgrp() == getpid()) { | 25 | /* Comment why is this necessary? */ |
26 | switch (fork()) { | 26 | if (getpgrp() == getpid()) |
27 | case -1: | 27 | forkexit_or_rexec(argv); |
28 | bb_perror_msg_and_die("fork"); | ||
29 | case 0: | ||
30 | break; | ||
31 | default: /* parent */ | ||
32 | exit(0); | ||
33 | } | ||
34 | } | ||
35 | /* child */ | ||
36 | 28 | ||
37 | setsid(); /* no error possible */ | 29 | setsid(); /* no error possible */ |
38 | 30 | ||
39 | BB_EXECVP(argv[1], argv + 1); | 31 | BB_EXECVP(argv[1], argv + 1); |
40 | |||
41 | bb_perror_msg_and_die("%s", argv[1]); | 32 | bb_perror_msg_and_die("%s", argv[1]); |
42 | } | 33 | } |