X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Funistd%2Fctermid.c;h=1612770af158ce068e2b9a1ecc89c4d910d76edd;hb=4554f155dd23a65fcdfd39f1d5af8af55ba37694;hp=ffa9b758cb60be3bc2e55c3224d6e3dc3d2e7082;hpb=b6218764ebca59ff5dae0e87b696188c8de0119e;p=musl diff --git a/src/unistd/ctermid.c b/src/unistd/ctermid.c index ffa9b758..1612770a 100644 --- a/src/unistd/ctermid.c +++ b/src/unistd/ctermid.c @@ -1,21 +1,7 @@ #include -#include #include -#include -#include -#include -#include "syscall.h" char *ctermid(char *s) { - static char s2[L_ctermid]; - int fd; - if (!s) s = s2; - *s = 0; - fd = open("/dev/tty", O_WRONLY | O_NOCTTY | O_CLOEXEC); - if (fd >= 0) { - ttyname_r(fd, s, L_ctermid); - __syscall(SYS_close, fd); - } - return s; + return s ? strcpy(s, "/dev/tty") : "/dev/tty"; }