patch-2.1.111 linux/fs/proc/generic.c

Next file: linux/fs/proc/proc_tty.c
Previous file: linux/fs/proc/base.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.110/linux/fs/proc/generic.c linux/fs/proc/generic.c
@@ -260,13 +260,16 @@
 	ent->name = ((char *) ent) + sizeof(*ent);
 	ent->namelen = len;
 
-	if (mode == S_IFDIR) {
+	if (S_ISDIR(mode)) {
+		if ((mode & S_IALLUGO) == 0)
 		mode |= S_IRUGO | S_IXUGO;
 		ent->ops = &proc_dyna_dir_inode_operations;
 		ent->nlink = 2;
-	}
-	else if (mode == 0) {
-		mode = S_IFREG | S_IRUGO;
+	} else {
+		if ((mode & S_IFMT) == 0)
+			mode |= S_IFREG;
+		if ((mode & S_IALLUGO) == 0)
+			mode |= S_IRUGO;
 		ent->nlink = 1;
 	}
 	ent->mode = mode;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov