patch-2.0.1 linux/fs/sysv/namei.c
Next file: linux/fs/umsdos/ioctl.c
Previous file: linux/fs/smbfs/proc.c
Back to the patch index
Back to the overall index
- Lines: 37
- Date:
Wed Jul 3 12:06:03 1996
- Orig file:
v2.0.0/linux/fs/sysv/namei.c
- Orig date:
Wed Nov 8 12:36:10 1995
diff -u --recursive --new-file v2.0.0/linux/fs/sysv/namei.c linux/fs/sysv/namei.c
@@ -668,7 +668,7 @@
* higher-level routines.
*/
static int do_sysv_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, * new_inode;
struct buffer_head * old_bh, * new_bh, * dir_bh;
@@ -694,6 +694,8 @@
old_inode = __iget(old_dir->i_sb, old_de->inode, 0); /* don't cross mnt-points */
if (!old_inode)
goto end_rename;
+ if (must_be_dir && !S_ISDIR(old_inode->i_mode))
+ goto end_rename;
retval = -EPERM;
if ((old_dir->i_mode & S_ISVTX) &&
current->fsuid != old_inode->i_uid &&
@@ -808,7 +810,8 @@
* as they are on different partitions.
*/
int sysv_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)
{
static struct wait_queue * wait = NULL;
static int lock = 0;
@@ -818,7 +821,7 @@
sleep_on(&wait);
lock = 1;
result = do_sysv_rename(old_dir, old_name, old_len,
- new_dir, new_name, new_len);
+ new_dir, new_name, new_len, must_be_dir);
lock = 0;
wake_up(&wait);
return result;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov