about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-04-12 20:47:33 +0000
committerUlrich Drepper <drepper@redhat.com>2000-04-12 20:47:33 +0000
commitfe46dd6e6d18898575096c09396714a6c2a04cf2 (patch)
tree0be1edb6edcbf8a864f0234044c84f50d4b5ba42
parentc4693424e2de38eb6f286d2f1b146b67adb010f0 (diff)
downloadglibc-fe46dd6e6d18898575096c09396714a6c2a04cf2.tar.gz
glibc-fe46dd6e6d18898575096c09396714a6c2a04cf2.tar.xz
glibc-fe46dd6e6d18898575096c09396714a6c2a04cf2.zip
(_IO_old_proc_open): Close pipes in case the mode is invalid.
-rw-r--r--libio/oldiopopen.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libio/oldiopopen.c b/libio/oldiopopen.c
index 556a9ff86f..63d8f82591 100644
--- a/libio/oldiopopen.c
+++ b/libio/oldiopopen.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU IO Library.
    Written by Per Bothner <bothner@cygnus.com>.
 
@@ -133,6 +133,8 @@ _IO_old_proc_open (fp, command, mode)
     }
   else
     {
+      _IO_close (pipe_fds[0]);
+      _IO_close (pipe_fds[1]);
       __set_errno (EINVAL);
       return NULL;
     }
@@ -141,7 +143,7 @@ _IO_old_proc_open (fp, command, mode)
     {
       int child_std_end = mode[0] == 'r' ? 1 : 0;
       struct _IO_proc_file *p;
-      
+
       _IO_close (parent_end);
       if (child_end != child_std_end)
 	{