This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix errno handling in posix_openpt


2009-10-27  Andreas Schwab  <schwab@redhat.com>

	* sysdeps/unix/sysv/linux/getpt.c (__posix_openpt): Make sure
	errno is always set when returning unsuccessfully.

diff --git a/sysdeps/unix/sysv/linux/getpt.c b/sysdeps/unix/sysv/linux/getpt.c
index bb1ea47..f3a1f81 100644
--- a/sysdeps/unix/sysv/linux/getpt.c
+++ b/sysdeps/unix/sysv/linux/getpt.c
@@ -67,6 +67,7 @@ __posix_openpt (oflag)
              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;
 }
-- 
1.6.5.1


Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]