Message ID | 1399294807-19817-1-git-send-email-aurelien@aurel32.net |
---|---|
State | New |
Headers | show |
Seems like something for which you could write a test case.
On Mon, May 05, 2014 at 12:37:21PM -0700, Roland McGrath wrote:
> Seems like something for which you could write a test case.
Indeed, we can at least test that the error value is the correct one.
Catching the use of uninitialized data in xstat64 looks more difficult.
I'll work on that and provide a new version of this patch including a
test.
diff --git a/ChangeLog b/ChangeLog index ac0d69e..cda0e7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-05-05 Aurelien Jarno <aurelien@aurel32.net> + + * sysdeps/unix/sysv/linux/ptsname.c (__ptsname_internal): return + errno if the TIOCGPTN ioctl fails with an error different than + EINVAL. + 2014-05-04 Adam Conrad <adconrad@0c3.net> * locale/iso-4217.def: Reintroduce XDR currency. diff --git a/sysdeps/unix/sysv/linux/ptsname.c b/sysdeps/unix/sysv/linux/ptsname.c index ed39f8f..3fc14a7 100644 --- a/sysdeps/unix/sysv/linux/ptsname.c +++ b/sysdeps/unix/sysv/linux/ptsname.c @@ -105,7 +105,9 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp) memcpy (__stpcpy (buf, devpts), p, &numbuf[sizeof (numbuf)] - p); } - else if (errno == EINVAL) + else if (errno != EINVAL) + return errno; + else #endif { char *p;