Mercurial > hg > octave-lojdl > gnulib-hg
changeset 13269:7dbe916e9b3f
ptsname: Fix misuse of ttyname_r.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 25 Apr 2010 22:18:48 +0200 |
parents | 7287ecc3411c |
children | f36dcb5c4dae |
files | ChangeLog lib/ptsname.c |
diffstat | 2 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-04-25 Bruno Haible <bruno@clisp.org> + + ptsname: Fix misuse of ttyname_r. + * lib/ptsname.c (__ptsname_r): Use __ttyname_r's return value instead + of errno. + 2010-04-25 Bruno Haible <bruno@clisp.org> ttyname_r: Make it work on Solaris 10.
--- a/lib/ptsname.c +++ b/lib/ptsname.c @@ -63,6 +63,7 @@ __ptsname_r (int fd, char *buf, size_t buflen) { int save_errno = errno; + int err; struct stat st; if (buf == NULL) @@ -81,8 +82,12 @@ return ERANGE; } - if (__ttyname_r (fd, buf, buflen) != 0) - return errno; + err = __ttyname_r (fd, buf, buflen); + if (err != 0) + { + __set_errno (err); + return errno; + } buf[sizeof (_PATH_DEV) - 1] = 't';