X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Funistd%2Fttyname_r.c;h=82acb75e19d60a6a075e7398dc23d9b4f8729e5d;hb=ef137da6428c342baabd3bcf9b5e91f75acefa64;hp=a38ba4f2b3ed628778d00f2b24c0faac4f88a5c2;hpb=0a950dcf15bb9f7274c804dca490e9e20e475f3e;p=musl diff --git a/src/unistd/ttyname_r.c b/src/unistd/ttyname_r.c index a38ba4f2..82acb75e 100644 --- a/src/unistd/ttyname_r.c +++ b/src/unistd/ttyname_r.c @@ -1,8 +1,7 @@ #include #include #include - -void __procfdname(char *, unsigned); +#include "syscall.h" int ttyname_r(int fd, char *name, size_t size) { @@ -10,7 +9,7 @@ int ttyname_r(int fd, char *name, size_t size) char procname[sizeof "/proc/self/fd/" + 3*sizeof(int) + 2]; ssize_t l; - if (!isatty(fd)) return ENOTTY; + if (!isatty(fd)) return errno; __procfdname(procname, fd); l = readlink(procname, name, size); @@ -23,7 +22,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; }