summaryrefslogtreecommitdiff
path: root/libc/termios/ttyname.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-11-05 16:28:56 +0000
committerEric Andersen <andersen@codepoet.org>2002-11-05 16:28:56 +0000
commitd9caf7de9815201ee6ddeeb21f57780fc75c0065 (patch)
tree2ba94558d667c6e3656bfdde6e93291d089ca204 /libc/termios/ttyname.c
parenta8535b442643ee097f875b96304cea58437eb2bc (diff)
A patch from Danny Lepage so that we do not setting on symlinks
when looking for a device match, and instead keep looking till we find the correct device.
Diffstat (limited to 'libc/termios/ttyname.c')
-rw-r--r--libc/termios/ttyname.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/termios/ttyname.c b/libc/termios/ttyname.c
index c5f22e405..c9c2c3242 100644
--- a/libc/termios/ttyname.c
+++ b/libc/termios/ttyname.c
@@ -26,10 +26,10 @@ static int __check_dir_for_tty_match(char * dirname, struct stat *st, char *buf,
* st_ino and st_dev uniquely identify a file, contrary to
* SuSv3, so we cannot be quite so precise as to require an
* exact match. Settle for something less... Grumble... */
- if (stat(buf, &dst) == 0 &&
+ if (lstat(buf, &dst) == 0 &&
st->st_dev == dst.st_dev && st->st_ino == dst.st_ino)
#else
- if (stat(buf, &dst) == 0 &&
+ if (lstat(buf, &dst) == 0 &&
S_ISCHR(dst.st_mode) && st->st_rdev == dst.st_rdev)
#endif
{