- // In child, sort out stdin/stdout
- reopen(0, "/dev/null", O_READ);
- reopen(1, gsServer_LogFile, O_CREAT|O_APPEND);
- reopen(2, gsServer_ErrorLog, O_CREAT|O_APPEND);
+ // In child
+ // - Sort out stdin/stdout
+ newin = open("/dev/null", O_RDONLY);
+ newout = open(gsServer_LogFile, O_CREAT|O_APPEND, 0644);
+ newerr = open(gsServer_ErrorLog, O_CREAT|O_APPEND, 0644);
+ dup2(newin, 0);
+ dup2(newout, 1);
+ dup2(newerr, 2);