12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #include "libbb.h"
- int setsid_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
- int setsid_main(int argc UNUSED_PARAM, char **argv)
- {
- unsigned opt;
-
- opt = getopt32(argv, "^+" "c" "\0" "-1");
- argv += optind;
-
- if (setsid() < 0) {
- pid_t pid = fork_or_rexec(argv);
- if (pid != 0) {
-
-
- return EXIT_SUCCESS;
- }
-
-
- setsid();
- }
- if (opt) {
-
- ioctl(0, TIOCSCTTY, 1);
- }
- BB_EXECVP_or_die(argv);
- }
|