This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix errno handling in posix_openpt
- From: Andreas Schwab <schwab at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 27 Oct 2009 14:02:52 +0100
- Subject: [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."