[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mint 1.10: biosfs.c -- bios_getxattr()
In bios_getxattr() it's not a good idea to return the attributes of the
file to which a fake device currently is pointing. Doing so messes
up things like ttyname() in the mint libs, because the /dev directory
ends up with several things pointing to the tty device (e.g. we
usually get "/dev/con" instead of a pipe name).
Julian suggested that I change the ttyname() function to search the /pipe
directory before /dev, but that doesn't really fix the problem because
logins on /dev/modem1 will get "/dev/aux" first since it appears earlier in
the device table. Since these entries in /dev are all supposed to be
character-special files anyway, making them look like different character
special files (or even making them appear to be real files, as may be the
case for /dev/fd/*) is counterintuitive anyway (and can screw up things like
tar, file, and find, which know about devices and inodes.)
biosfs.c: ++entropy@terminator.rs.itd.umich.edu
Don't "follow the chain" for character special devices
in bios_getxattr().
--- 1.10.1.3 1994/02/19 09:09:48
+++ biosfs.c 1994/02/24 14:41:38
@@ -349,9 +349,11 @@
fcookie *fc;
XATTR *xattr;
{
+#ifdef XATTR_FOLLOW_CHAIN
FILEPTR *f;
- struct bios_file *b = (struct bios_file *)fc->index;
long r;
+#endif
+ struct bios_file *b = (struct bios_file *)fc->index;
int majdev, mindev;
majdev = UNK_RDEV;
@@ -367,26 +369,34 @@
xattr->dev = fc->dev;
} else if (IS_FD_ENTRY(fc)) {
/* u:\dev\fd\n */
+#ifdef FOLLOW_XATTR_CHAIN
f = curproc->handle[(int)fc->aux];
if (f) {
r = (*f->fc.fs->getxattr)(&f->fc, xattr);
if (r < 0)
return r;
} else {
+#endif
majdev = FAKE_RDEV;
mindev = ((int)fc->aux) & 0x00ff;
set_xattr(xattr, S_IFCHR | DEFAULT_MODE, majdev|mindev);
+#ifdef FOLLOW_XATTR_CHAIN
}
+#endif
} else if (b->device == &fakedev) {
+#ifdef FOLLOW_XATTR_CHAIN
if ((f = curproc->handle[b->private]) != 0) {
/* u:\dev\stdin, u:\dev\stdout, etc. */
r = (*f->fc.fs->getxattr) (&f->fc, xattr);
if (r < 0) return r;
} else {
+#endif
majdev = FAKE_RDEV;
mindev = ((int)b->private) & 0x00ff;
set_xattr(xattr, S_IFCHR|DEFAULT_MODE, majdev|mindev);
+#ifdef FOLLOW_XATTR_CHAIN
}
+#endif
} else {
*xattr = b->xattr;
xattr->index = fc->index;
--
entropy -- it's not just a good idea, it's the second law.
Personal mail: entropy@gnu.ai.mit.edu
MiNT library mail: entropy@terminator.rs.itd.umich.edu
"what do you have against octal?" -jrb