diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 2003-06-21 08:16:12 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2003-06-21 08:16:12 +0000 |
| commit | 97679e71b0bb9261412b5b8721ba5479657856cb (patch) | |
| tree | f9670d7e6200ea5700b9d1ab1b38c6f5aca56ef2 /lib/libc | |
| parent | ebf75125322418c4fed1edfcae67aa5f0229c671 (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/gen/ttyname.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libc/gen/ttyname.c b/lib/libc/gen/ttyname.c index 0def640e3422..22f74883dda3 100644 --- a/lib/libc/gen/ttyname.c +++ b/lib/libc/gen/ttyname.c @@ -93,7 +93,10 @@ ttyname_r(int fd, char *buf, size_t len) if (len <= sizeof(_PATH_DEV)) return (rval); - return(devname_r(sb.st_rdev, S_IFCHR, buf, sizeof(buf))); + strcpy(buf, _PATH_DEV); + devname_r(sb.st_rdev, S_IFCHR, + buf + strlen(buf), sizeof(buf) - strlen(buf)); + return (buf); } static char * @@ -140,5 +143,8 @@ ttyname_unthreaded(int fd) if (_fstat(fd, &sb) || !S_ISCHR(sb.st_mode)) return (NULL); - return(devname_r(sb.st_rdev, S_IFCHR, buf, sizeof(buf))); + strcpy(buf, _PATH_DEV); + devname_r(sb.st_rdev, S_IFCHR, + buf + strlen(buf), sizeof(buf) - strlen(buf)); + return (buf); } |
