Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu,  6 Apr 2017 00:32:18 +0200
From: Christian Brauner <christian.brauner@...ntu.com>
To: musl@...ts.openwall.com
Cc: Christian Brauner <christian.brauner@...ntu.com>
Subject: [PATCH 1/1] linux ttyname{_r}: return ENODEV not ENOENT

While musl correctly detects whether the pts device a given file descriptor
refers to can be retrieved it returns ENOENT. We've recently upstreamed a patch
to glibc which uses ENODEV. This has been after a discussion about what would be
most in line with POSIX. Additionally we fixed a bunch of programs to handle the
ENODEV case. It would be good if musl would also set ENODEV instead of ENOENT to
enable programs to have uniform handle on this case.

Signed-off-by: Christian Brauner <christian.brauner@...ntu.com>
---
 src/unistd/ttyname_r.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 }
-- 
2.11.0

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.