Page MenuHomeFreeBSD

D25559.id74099.diff
No OneTemporary

D25559.id74099.diff

Index: sys/compat/linux/linux_stats.c
===================================================================
--- sys/compat/linux/linux_stats.c
+++ sys/compat/linux/linux_stats.c
@@ -165,6 +165,20 @@
bzero(&tbuf, sizeof(tbuf));
tbuf.st_dev = dev_to_ldev(buf->st_dev);
+
+ /*
+ * Return the same st_dev for every devfs instance. The reason
+ * for this is to work around an idiosyncrasy of glibc getttynam()
+ * implementation: it checks whether st_dev returned for fd 0
+ * is the same as st_dev returned for the target of /proc/self/fd/0
+ * symlink, and with linux chroots having their own devfs instance,
+ * the check will fail if you chroot into it.
+ */
+ if ((S_ISCHR(buf->st_mode) || S_ISBLK(buf->st_mode)) &&
+ rootdevmp != NULL) {
+ tbuf.st_dev = dev_to_ldev(rootdevmp->mnt_stat.f_fsid.val[0]);
+ }
+
tbuf.st_ino = buf->st_ino;
tbuf.st_mode = buf->st_mode;
tbuf.st_nlink = buf->st_nlink;

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 12, 11:57 AM (32 m, 55 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31346715
Default Alt Text
D25559.id74099.diff (920 B)

Event Timeline