Changeset 1765 in MondoRescue for branches/2.2.5/mindi-busybox/miscutils/setsid.c
- Timestamp:
- Nov 4, 2007, 3:16:40 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.5/mindi-busybox/miscutils/setsid.c
r821 r1765 15 15 */ 16 16 17 #include "busybox.h" 18 #include <stdio.h> 19 #include <unistd.h> 20 #include <stdlib.h> 17 #include "libbb.h" 21 18 22 int setsid_main(int argc, char *argv[]) 19 int setsid_main(int argc, char **argv); 20 int setsid_main(int argc, char **argv) 23 21 { 24 22 if (argc < 2) 25 23 bb_show_usage(); 26 24 27 if (getpgrp() == getpid()) { 28 switch(fork()){ 29 case -1: 30 bb_perror_msg_and_die("fork"); 31 case 0: 32 break; 33 default: /* parent */ 34 exit(0); 35 } 36 /* child falls through */ 37 } 25 /* Comment why is this necessary? */ 26 if (getpgrp() == getpid()) 27 forkexit_or_rexec(argv); 38 28 39 29 setsid(); /* no error possible */ 40 30 41 execvp(argv[1], argv + 1); 42 31 BB_EXECVP(argv[1], argv + 1); 43 32 bb_perror_msg_and_die("%s", argv[1]); 44 33 }
Note:
See TracChangeset
for help on using the changeset viewer.