projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fb247fa
)
fix broken ttyname[_r] (failure to null-terminate result)
author
Rich Felker
<dalias@aerifal.cx>
Fri, 7 Sep 2012 00:21:13 +0000
(20:21 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Fri, 7 Sep 2012 00:21:13 +0000
(20:21 -0400)
src/unistd/ttyname_r.c
patch
|
blob
|
history
diff --git
a/src/unistd/ttyname_r.c
b/src/unistd/ttyname_r.c
index f86fbd9c9bccd0dc33c7ab6dacb2dfe17382309c..2255e2dfebb7a5c2e8378e38879792dba88476f0 100644
(file)
--- 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;
+ }
}