Skip to content
Snippets Groups Projects
Commit b983ce59 authored by George Nachman's avatar George Nachman
Browse files

Port over fix to bug 2662 from master branch (leaking file descriptors)

parent 4b32191d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -664,6 +664,12 @@ static void reapchild(int n)
sigaddset(&signals, SIGPIPE);
sigprocmask(SIG_UNBLOCK, &signals, NULL);
 
// Apple opens files without the close-on-exec flag (e.g., Extras2.rsrc).
// See issue 2662.
for (int j = 3; j < getdtablesize(); j++) {
close(j);
}
chdir(initialPwd);
// Sub in our environ for the existing one. Since Mac OS doesn't have execvpe, this hack
// does the job.
Loading
Loading
@@ -693,6 +699,9 @@ static void reapchild(int n)
}
free(newEnviron);
 
// Make sure the master side of the pty is closed on future exec() calls.
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
tty = [[NSString stringWithUTF8String:theTtyname] retain];
NSParameterAssert(tty != nil);
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment