bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10284: "Renaming: permission denied" file-error in Windows


From: Eli Zaretskii
Subject: bug#10284: "Renaming: permission denied" file-error in Windows
Date: Thu, 29 Dec 2011 01:18:02 -0500

> Date: Wed, 28 Dec 2011 21:53:39 +0200
> From: LynX <_LynX@bk.ru>
> 
>  > This first removes the target, and only then compares the device
>  > numbers.  Wouldn't it be better to do it the other way around, at
>  > least when the target is a directory?  That way, the target is left
>  > intact if the caller doesn't want to copy over the target, and also
>  > the filesystem is left in the same state as on Posix hosts in this
>  > case, i.e. the contract of `rename' is preserved on all systems.
> 
> You mean that before setting errno to EXDEV we also need to check that 
> target is a directory (since files are moved correctly)?

Yes, but that's not the important part of my comment above.  The
important part is to move the check for different devices _before_ the
call to _unlink which removes the target file/directory if it exists.
In other words, we should fail and report EXDEV without risking the
removal of the target, and let the caller decide what to do with the
failure.  (If the caller decides to leave things unchanged, it will
not be The Right Thing for us to remove the target.)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]