[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Bug moving file over link?
- From: Andrew Morton <akpm digeo com>
- To: cs zip com au
- Cc: bescoto stanford edu, ext3-users redhat com, sct redhat com
- Subject: Re: Bug moving file over link?
- Date: Sat, 8 Feb 2003 16:57:04 -0800
Cameron Simpson <cs zip com au> wrote:
>
> | Can someone explain to me what is happening here:
> |
> | ~ $ touch foo
> | ~ $ ln foo bar
> | ~ $ ls foo bar
> | bar foo
> | ~ $ mv foo bar
> | ~ $ ls foo bar
> | bar foo
> |
> | I try to move a file over a hard linked copy of itself and the move
> | fails, but there is no error. Is this the intended behavior?
Yes, it is.
int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry)
{
int error;
int is_dir = S_ISDIR(old_dentry->d_inode->i_mode);
if (old_dentry->d_inode == new_dentry->d_inode)
return 0;
The Open Group base specification 6 says:
"If the old argument and the new argument resolve to the same existing file,
rename() shall return successfully and perform no other action."
http://www.opengroup.org/onlinepubs/007904975/functions/rename.html
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]