Changeset 988 for vendor/current/source3/lib/smbrun.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/lib/smbrun.c
r414 r988 19 19 20 20 #include "includes.h" 21 #include "system/filesys.h" 21 22 22 23 /* need to move this from here!! need some sleep ... */ … … 32 33 TALLOC_CTX *ctx = talloc_stackframe(); 33 34 char *path = NULL; 35 mode_t mask; 34 36 35 37 path = talloc_asprintf(ctx, … … 43 45 44 46 /* now create the file */ 47 mask = umask(S_IRWXO | S_IRWXG); 45 48 fd = mkstemp(path); 49 umask(mask); 46 50 47 51 if (fd == -1) { … … 70 74 uid_t uid = current_user.ut.uid; 71 75 gid_t gid = current_user.ut.gid; 76 void (*saved_handler)(int); 72 77 73 78 /* … … 91 96 */ 92 97 93 CatchChildLeaveStatus();98 saved_handler = CatchChildLeaveStatus(); 94 99 95 if ((pid= sys_fork()) < 0) {100 if ((pid=fork()) < 0) { 96 101 DEBUG(0,("smbrun: fork failed with error %s\n", strerror(errno) )); 97 CatchChild();102 (void)CatchSignal(SIGCLD, saved_handler); 98 103 if (outfd) { 99 104 close(*outfd); … … 120 125 } 121 126 122 CatchChild();127 (void)CatchSignal(SIGCLD, saved_handler); 123 128 124 129 if (wpid != pid) { … … 133 138 /* Reset the seek pointer. */ 134 139 if (outfd) { 135 sys_lseek(*outfd, 0, SEEK_SET);140 lseek(*outfd, 0, SEEK_SET); 136 141 } 137 142 … … 145 150 } 146 151 147 CatchChild();152 (void)CatchChild(); 148 153 149 154 /* we are in the child. we exec /bin/sh to do the work for us. we … … 234 239 gid_t gid = current_user.ut.gid; 235 240 int ifd[2]; 241 void (*saved_handler)(int); 236 242 237 243 /* … … 254 260 */ 255 261 256 CatchChildLeaveStatus();262 saved_handler = CatchChildLeaveStatus(); 257 263 258 if ((pid= sys_fork()) < 0) {264 if ((pid=fork()) < 0) { 259 265 DEBUG(0, ("smbrunsecret: fork failed with error %s\n", strerror(errno))); 260 CatchChild();266 (void)CatchSignal(SIGCLD, saved_handler); 261 267 return errno; 262 268 } … … 290 296 } 291 297 292 CatchChild();298 (void)CatchSignal(SIGCLD, saved_handler); 293 299 294 300 if (wpid != pid) { … … 306 312 } 307 313 308 CatchChild();314 (void)CatchChild(); 309 315 310 316 /* we are in the child. we exec /bin/sh to do the work for us. we
Note:
See TracChangeset
for help on using the changeset viewer.