__ptsname_r setting errno or not
Bruno Haible
bruno@clisp.org
Fri Sep 20 07:13:00 GMT 2002
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.
More information about the Libc-alpha
mailing list