about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/unistd/ttyname_r.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/unistd/ttyname_r.c b/src/unistd/ttyname_r.c
index f86fbd9c..2255e2df 100644
--- a/src/unistd/ttyname_r.c
+++ b/src/unistd/ttyname_r.c
@@ -15,5 +15,8 @@ int ttyname_r(int fd, char *name, size_t size)
 
 	if (l < 0) return errno;
 	else if (l == size) return ERANGE;
-	else return 0;
+	else {
+		name[l] = 0;
+		return 0;
+	}
 }