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

Next file: linux/fs/xiafs/namei.c
Previous file: linux/fs/umsdos/namei.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.0/linux/fs/vfat/namei.c linux/fs/vfat/namei.c
@@ -1352,7 +1352,7 @@
 
 
 int vfat_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 super_block *sb = old_dir->i_sb;
 	struct buffer_head *old_bh,*new_bh,*dotdot_bh;
@@ -1383,8 +1383,12 @@
 	PRINTK(("vfat_rename 3\n"));
 	if (res < 0) goto rename_done;
 
-	if (!(old_inode = iget(old_dir->i_sb,old_ino))) goto rename_done;
+	res = -ENOENT;
+	if (!(old_inode = iget(old_dir->i_sb,old_ino)))
+		goto rename_done;
 	is_dir = S_ISDIR(old_inode->i_mode);
+	if (must_be_dir && !is_dir)
+		goto rename_done;
 	if (is_dir) {
 		if ((old_dir->i_dev != new_dir->i_dev) ||
 		    (old_ino == new_dir->i_ino)) {

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