patch-2.2.7 linux/fs/proc/fd.c

Next file: linux/fs/proc/openpromfs.c
Previous file: linux/fs/ntfs/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.6/linux/fs/proc/fd.c linux/fs/proc/fd.c
@@ -19,7 +19,7 @@
 #include <asm/uaccess.h>
 
 static int proc_readfd(struct file *, void *, filldir_t);
-static int proc_lookupfd(struct inode *, struct dentry *);
+static struct dentry *proc_lookupfd(struct inode *, struct dentry *);
 
 static struct file_operations proc_fd_operations = {
 	NULL,			/* lseek - default */
@@ -67,7 +67,7 @@
  *
  * Thus just return -ENOENT instead.
  */
-static int proc_lookupfd(struct inode * dir, struct dentry * dentry)
+static struct dentry *proc_lookupfd(struct inode * dir, struct dentry * dentry)
 {
 	unsigned int ino, pid, fd, c;
 	struct task_struct * p;
@@ -77,13 +77,11 @@
 	int len, err;
 
 	err = -ENOENT;
-	if (!dir)
-		goto out;
 	ino = dir->i_ino;
 	pid = ino >> 16;
 	ino &= 0x0000ffff;
 
-	if (!pid || ino != PROC_PID_FD || !S_ISDIR(dir->i_mode))
+	if (!pid || ino != PROC_PID_FD)
 		goto out;
 
 	fd = 0;
@@ -121,10 +119,10 @@
 	if (inode) {
 		dentry->d_op = &proc_dentry_operations;
 		d_add(dentry, inode);
-		err = 0;
+		return NULL;
 	}
 out:
-	return err;
+	return ERR_PTR(err);
 }
 
 #define NUMBUF 10
@@ -136,10 +134,6 @@
 	unsigned int fd, pid, ino;
 	int retval;
 	char buf[NUMBUF];
-
-	retval = -EBADF;
-	if (!inode || !S_ISDIR(inode->i_mode))
-		goto out;
 
 	retval = 0;
 	ino = inode->i_ino;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)