cvs commit: src/lib/libc/gen ttyname.c
Hajimu UMEMOTO
ume at FreeBSD.org
Sun May 15 03:07:55 PDT 2005
Hi,
>>>>> On Sun, 15 May 2005 15:16:39 +0900
>>>>> Hajimu UMEMOTO <ume at FreeBSD.org> said:
ume> It doesn't test return value of ttyname_r().
It seems there is one more problem. ttyname_r() doesn't pass correct
buffer size to devname_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 19:02:39 2005
@@ -85,7 +85,7 @@ ttyname_r(int fd, char *buf, size_t len)
if (!_ioctl(fd, FIODGNAME, &fgn))
return (0);
devname_r(sb.st_rdev, S_IFCHR,
- buf + strlen(buf), sizeof(buf) - strlen(buf));
+ buf + strlen(buf), len - strlen(buf));
return (0);
}
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