This is the mail archive of the libc-alpha@sources.redhat.com 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]

__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.


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