Changeset 6149 in vbox
- Timestamp:
- Dec 19, 2007 9:42:02 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxService-solaris.cpp
r6144 r6149 58 58 return -1; 59 59 60 int pid = fork();60 pid_t pid = fork(); 61 61 if (pid < 0) /* The fork() failed. Bad. */ 62 62 return -1; … … 69 69 * rid of signals, file descriptors & other stuff we inherited from the parent. 70 70 */ 71 setsid(); 71 pid_t newpgid = setsid(); 72 if (newpgid < 0) /* Failed to create new sesion */ 73 return -1; 72 74 73 /* Close all or only standard streams */ 74 int size = noclose ? getdtablesize() : 2; 75 for (int i = size; i >= 0; i--) 76 close(i); 77 78 /* Open stdin(0), stdout(1) and stderr(2) to /dev/null */ 79 int fd = open("/dev/null", O_RDWR); 80 dup(fd); 81 dup(fd); 75 /* BSD daemon style. */ 76 if (!noclose) 77 { 78 /* Open stdin(0), stdout(1) and stderr(2) to /dev/null */ 79 int fd = open("/dev/null", O_RDWR); 80 dup2(fd, STDIN_FILENO); 81 dup2(fd, STDOUT_FILENO); 82 dup2(fd, STDERR_FILENO); 83 if (fd > 2) 84 close(fd); 85 } 82 86 83 87 /* Switch our current directory to root */
Note:
See TracChangeset
for help on using the changeset viewer.