Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 May 2005 15:16:39 +0900
From:      Hajimu UMEMOTO <ume@FreeBSD.org>
To:        Xin LI <delphij@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/lib/libc/gen ttyname.c
Message-ID:  <yge3bspj9o8.wl%ume@mahoroba.org>
In-Reply-To: <200505141403.j4EE3LYX097762@repoman.freebsd.org>
References:  <200505141403.j4EE3LYX097762@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

>>>>> On Sat, 14 May 2005 14:03:21 +0000 (UTC)
>>>>> Xin LI <delphij@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@mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?yge3bspj9o8.wl%ume>