diff options
author | Ryan Lortie <desrt@desrt.ca> | 2010-03-22 11:59:08 -0500 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2010-03-22 12:03:24 -0500 |
commit | ace9a25fb39781a01a78c8e9aa1c58a51224e8b8 (patch) | |
tree | d52831fea19c411cc01ad1bbbfa78452df410e14 /gio/gunixfdlist.c | |
parent | 440713e393cf99e29f716f5f634d4bc4ce0e281c (diff) |
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.
Diffstat (limited to 'gio/gunixfdlist.c')
-rw-r--r-- | gio/gunixfdlist.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gio/gunixfdlist.c b/gio/gunixfdlist.c index df715b21a..026c1276e 100644 --- a/gio/gunixfdlist.c +++ b/gio/gunixfdlist.c @@ -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; |