patch-2.0.1 linux/fs/affs/namei.c

Next file: linux/fs/exec.c
Previous file: linux/drivers/sound/uart6850.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.0/linux/fs/affs/namei.c linux/fs/affs/namei.c
@@ -535,7 +535,8 @@
 
 int
 affs_rename(struct inode *old_dir, const char *old_name, int old_len,
-	    struct inode *new_dir, const char *new_name, int new_len)
+	    struct inode *new_dir, const char *new_name, int new_len,
+	    int must_be_dir)
 {
 	struct inode		*old_inode;
 	struct inode		*new_inode;
@@ -568,6 +569,8 @@
 		goto end_rename;
 	old_inode = __iget(old_dir->i_sb,old_ino,0);
 	if (!old_inode)
+		goto end_rename;
+	if (must_be_dir && !S_ISDIR(old_inode->i_mode))
 		goto end_rename;
 	new_bh = affs_find_entry(new_dir,new_name,new_len,&new_ino);
 	if (new_bh) {

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