From: Rich Felker Date: Fri, 21 Apr 2017 21:41:10 +0000 (-0400) Subject: make ttyname[_r] return ENODEV rather than ENOENT X-Git-Tag: v1.1.17~72 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e1232f5b5185e8f337806841018369407e32e77d;p=oweals%2Fmusl.git make ttyname[_r] return ENODEV rather than ENOENT commit 0a950dcf15bb9f7274c804dca490e9e20e475f3e added checking that the pathname a tty device was opened with actually matches the device, which can fail to hold when a container inherits a tty from outside the container. the error code added at the time was ENOENT; however, discussions between affected applications and glibc developers resulted in glibc adopting ENODEV as the error for this condition, and this has now been documented in the man pages project as well. adopt the same error code for consistency. patch by Christian Brauner. --- diff --git a/src/unistd/ttyname_r.c b/src/unistd/ttyname_r.c index a38ba4f2..33aa4ae1 100644 --- a/src/unistd/ttyname_r.c +++ b/src/unistd/ttyname_r.c @@ -23,7 +23,7 @@ int ttyname_r(int fd, char *name, size_t size) if (stat(name, &st1) || fstat(fd, &st2)) return errno; if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino) - return ENOENT; + return ENODEV; return 0; }