This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
__ptsname_r setting errno or not
- From: Bruno Haible <bruno at clisp dot org>
- To: libc-alpha at sources dot redhat dot com
- Date: Fri, 20 Sep 2002 16:14:35 +0200 (CEST)
- Subject: __ptsname_r setting errno or not
sysdeps/unix/grantpt.c apparently assumes that __ptsname_r sets errno to
the return value (if != 0). But this is not always the case; see
sysdeps/mach/hurd/ptsname.c. Therefore better don't rely on it.
2002-09-18 Bruno Haible <bruno@clisp.org>
* sysdeps/unix/grantpt.c (pts_name): Don't rely on errno after
calling __ptsname_r.
diff -r -c3 glibc-20020910.bak/sysdeps/unix/grantpt.c glibc-20020910/sysdeps/unix/grantpt.c
*** glibc-20020910.bak/sysdeps/unix/grantpt.c Mon Aug 26 15:50:05 2002
--- glibc-20020910/sysdeps/unix/grantpt.c Wed Sep 18 23:41:59 2002
***************
*** 51,56 ****
--- 51,57 ----
rv = __ptsname_r (fd, buf, buf_len);
if (rv != 0)
{
+ errno = rv;
if (rv == ENOTTY)
/* ptsname_r returns with ENOTTY to indicate
a descriptor not referring to a pty master.