patch-2.1.44 linux/fs/stat.c

Next file: linux/fs/super.c
Previous file: linux/fs/smbfs/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.43/linux/fs/stat.c linux/fs/stat.c
@@ -127,7 +127,7 @@
 	int error;
 
 	lock_kernel();
-	error = namei(NAM_FOLLOW_LINK, filename, &inode);
+	error = namei(filename, &inode);
 	if (error)
 		goto out;
 	if ((error = do_revalidate(inode)) == 0)
@@ -145,7 +145,7 @@
 	int error;
 
 	lock_kernel();
-	error = namei(NAM_FOLLOW_LINK, filename, &inode);
+	error = namei(filename, &inode);
 	if (error)
 		goto out;
 	if ((error = do_revalidate(inode)) == 0)
@@ -168,7 +168,7 @@
 	int error;
 
 	lock_kernel();
-	error = namei(NAM_FOLLOW_TRAILSLASH, filename, &inode);
+	error = lnamei(filename, &inode);
 	if (error)
 		goto out;
 	if ((error = do_revalidate(inode)) == 0)
@@ -187,7 +187,7 @@
 	int error;
 
 	lock_kernel();
-	error = namei(NAM_FOLLOW_TRAILSLASH, filename, &inode);
+	error = lnamei(filename, &inode);
 	if (error)
 		goto out;
 	if ((error = do_revalidate(inode)) == 0)
@@ -241,15 +241,13 @@
 asmlinkage int sys_readlink(const char * path, char * buf, int bufsiz)
 {
 	struct inode * inode;
-	int error = -EINVAL;
+	int error;
 
-	lock_kernel();
 	if (bufsiz <= 0)
-		goto out;
-	error = verify_area(VERIFY_WRITE,buf,bufsiz);
-	if (error)
-		goto out;
-	error = namei(NAM_FOLLOW_TRAILSLASH, path, &inode);
+		return -EINVAL;
+
+	lock_kernel();
+	error = lnamei(path, &inode);
 	if (error)
 		goto out;
 	error = -EINVAL;
@@ -263,6 +261,7 @@
 		inode->i_dirt = 1;
 	}
 	error = inode->i_op->readlink(inode,buf,bufsiz);
+	iput(inode);
 out:
 	unlock_kernel();
 	return error;

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