make ttyname[_r] return ENODEV rather than ENOENT
commit 0a950dcf15 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.
This commit is contained in:
1 parent
1a7fa5e521
commit
e1232f5b51
1 file changed
+1
-1
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user