cvs commit: src/lib/libc/gen ttyname.c

Hajimu UMEMOTO ume at FreeBSD.org
Sat May 14 23:16:51 PDT 2005


Hi,

>>>>> On Sat, 14 May 2005 14:03:21 +0000 (UTC)
>>>>> Xin LI <delphij at FreeBSD.org> said:

delphij> delphij     2005-05-14 14:03:21 UTC

delphij>   Modified files:
delphij>     lib/libc/gen         ttyname.c 
delphij>   Log:
delphij>   Revert to old ttyname_r behavior that when _ioctl() returns 0 (SUCCEEDED),
delphij>   return the buffer immediately.  This will permit ssh and/or PAM logins
delphij>   broken by previous commit.
  
delphij>   The (potential) underlying problem is still under investigation.

It doesn't test return value of ttyname_r().

Index: lib/libc/gen/ttyname.c
diff -u -p lib/libc/gen/ttyname.c.orig lib/libc/gen/ttyname.c
--- lib/libc/gen/ttyname.c.orig	Sun May 15 13:32:19 2005
+++ lib/libc/gen/ttyname.c	Sun May 15 15:10:24 2005
@@ -124,7 +124,8 @@ ttyname(int fd)
 			return (NULL);
 		}
 	}
-	ttyname_r(fd, buf, sizeof(_PATH_DEV) + MAXNAMLEN);
+	if (ttyname_r(fd, buf, sizeof(_PATH_DEV) + MAXNAMLEN) != 0)
+		return (NULL);
 	return (buf);
 }
 

Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume at mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/


More information about the cvs-src mailing list