about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2009-10-29 11:27:53 -0700
committerUlrich Drepper <drepper@redhat.com>2009-10-29 11:27:53 -0700
commitd79eccd6dd8aa2038a9775689a7072fe3ceb40dc (patch)
treea0f289d1eba1f699664bebc831c190c29e8a128b /sysdeps
parent22bc5239e1c7d97b0642af6c135af994586f8e82 (diff)
downloadglibc-d79eccd6dd8aa2038a9775689a7072fe3ceb40dc.tar.gz
glibc-d79eccd6dd8aa2038a9775689a7072fe3ceb40dc.tar.xz
glibc-d79eccd6dd8aa2038a9775689a7072fe3ceb40dc.zip
Fix errno handling in posix_openpt.
The implementation of posix_openpt on Linux can fail in a few extra
ways if the appropriate pseudo filesystems are not mounted etc.  In
some of these cases we have to explicitly set errno.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/getpt.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/getpt.c b/sysdeps/unix/sysv/linux/getpt.c
index bb1ea47643..6b26fdfcdc 100644
--- a/sysdeps/unix/sysv/linux/getpt.c
+++ b/sysdeps/unix/sysv/linux/getpt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2001, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
 
@@ -64,9 +64,10 @@ __posix_openpt (oflag)
 	    }
 
 	  /* If /dev/pts is not mounted then the UNIX98 pseudo terminals
-             are not usable.  */
+	     are not usable.  */
 	  __close (fd);
 	  have_no_dev_ptmx = 1;
+	  __set_errno (ENOENT);
 	}
       else
 	{
@@ -76,6 +77,8 @@ __posix_openpt (oflag)
 	    return -1;
 	}
     }
+  else
+    __set_errno (ENOENT);
 
   return -1;
 }