[glib] glib-unix.c: Don't leak FDs if pipe2() succeeds



commit 511070fb2803c799b953ac938b81c79c5e1036f8
Author: Colin Walters <walters verbum org>
Date:   Tue May 3 16:22:13 2011 -0400

    glib-unix.c: Don't leak FDs if pipe2() succeeds

 glib/glib-unix.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/glib/glib-unix.c b/glib/glib-unix.c
index 5a0f7f7..d88455a 100644
--- a/glib/glib-unix.c
+++ b/glib/glib-unix.c
@@ -111,6 +111,8 @@ g_unix_pipe_flags (int     *fds,
     ecode = pipe2 (fds, pipe2_flags);
     if (ecode == -1 && errno != ENOSYS)
       return g_unix_set_error_from_errno (error);
+    else if (ecode == 0)
+      return TRUE;
     /* Fall through on -ENOSYS, we must be running on an old kernel */
   }
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]