Bug 613601 - buglet in dup_close_on_exec_fd()

Fix copy/paste error and 'or' FD_CLOEXEC into the existing flags instead
of just setting it outright.
This commit is contained in:
Ryan Lortie 2010-03-22 11:59:08 -05:00
parent 440713e393
commit ace9a25fb3

View File

@ -117,10 +117,15 @@ dup_close_on_exec_fd (gint fd,
}
do
s = fcntl (new_fd, F_SETFD, FD_CLOEXEC);
{
s = fcntl (new_fd, F_GETFD);
if (s >= 0)
s = fcntl (new_fd, F_SETFD, (long) (s | FD_CLOEXEC));
}
while (s < 0 && (errno == EINTR));
if (new_fd < 0)
if (s < 0)
{
int saved_errno = errno;