From: Rich Felker Date: Fri, 7 Sep 2012 00:21:13 +0000 (-0400) Subject: fix broken ttyname[_r] (failure to null-terminate result) X-Git-Tag: v0.9.5~60 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fcfba99503746e44585d7e318562dd425e8ff390;p=oweals%2Fmusl.git fix broken ttyname[_r] (failure to null-terminate result) --- 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; + } }