about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/ttyname_r.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-04-01 09:33:06 +0000
committerUlrich Drepper <drepper@redhat.com>1999-04-01 09:33:06 +0000
commit7081e0a34c10eb54ab5f4ca62c5f4f4fa222cbff (patch)
treefda38fedb445849308078250919804b45243f99e /sysdeps/unix/sysv/linux/ttyname_r.c
parent134c659cc7af735b8e9dc4fc765eb5fa75ec9e14 (diff)
downloadglibc-7081e0a34c10eb54ab5f4ca62c5f4f4fa222cbff.tar.gz
glibc-7081e0a34c10eb54ab5f4ca62c5f4f4fa222cbff.tar.xz
glibc-7081e0a34c10eb54ab5f4ca62c5f4f4fa222cbff.zip
Update.
1999-04-01  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* sysdeps/unix/sysv/linux/ttyname.c (ttyname): Terminate the
	string.
	* sysdeps/unix/sysv/linux/ttyname_r.c (__ttyname_r): Likewise.
Diffstat (limited to 'sysdeps/unix/sysv/linux/ttyname_r.c')
-rw-r--r--sysdeps/unix/sysv/linux/ttyname_r.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c
index b92c712fcc..9a0ce4cea9 100644
--- a/sysdeps/unix/sysv/linux/ttyname_r.c
+++ b/sysdeps/unix/sysv/linux/ttyname_r.c
@@ -134,7 +134,10 @@ __ttyname_r (fd, buf, buflen)
 
   ret = __readlink (procname, buf, buflen - 1);
   if (ret != -1 && buf[0] != '[')
-    return 0;
+    {
+      buf[ret] = '\0';
+      return 0;
+    }
   if (ret == -1 && errno == ENAMETOOLONG)
     {
       __set_errno (ERANGE);