summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-07-06 00:00:40 +0000
committerEric Andersen <andersen@codepoet.org>2002-07-06 00:00:40 +0000
commit5e7ec59ff0820f26e7d57ba6bc3f5ac262bcafe5 (patch)
treedc4f297370daf540411f61c2745def515582da06 /libc
parent95dfbf5eb9150d61ff922fb4beebfa5a399229c4 (diff)
Stupid filesystems like cramfs fail to guarantee that 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... -Erik
Diffstat (limited to 'libc')
-rw-r--r--libc/termios/ttyname.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libc/termios/ttyname.c b/libc/termios/ttyname.c
index 695d75ee0..c5f22e405 100644
--- a/libc/termios/ttyname.c
+++ b/libc/termios/ttyname.c
@@ -21,8 +21,17 @@ static int __check_dir_for_tty_match(char * dirname, struct stat *st, char *buf,
while ((d = readdir(fp)) != 0) {
strncpy(buf+len, d->d_name, buflen);
buf[buflen]='\0';
- if (stat(buf, &dst) == 0 && st->st_dev == dst.st_dev
- && st->st_ino == dst.st_ino)
+#if 0
+ /* Stupid filesystems like cramfs fail to guarantee that
+ * 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 &&
+ st->st_dev == dst.st_dev && st->st_ino == dst.st_ino)
+#else
+ if (stat(buf, &dst) == 0 &&
+ S_ISCHR(dst.st_mode) && st->st_rdev == dst.st_rdev)
+#endif
{
closedir(fp);
return 0;