mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
mv -T DIR EMPTY_DIR no longer fails
(copy_internal): Don't manually prohibit a move where the destination is an existing directory. Sometimes doing that is valid. Let the rename system call enforce the rules. That is allowed only when the source is a directory and the destination directory (to be replaced) is empty. Reported by Eric Blake.
This commit is contained in:
1 parent
8ebce3d9a5
commit
156459c2f5
1 file changed
-8
@@ -1157,14 +1157,6 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
|
||||
if (x->move_mode)
|
||||
{
|
||||
/* In move_mode, DEST may not be an existing directory. */
|
||||
if (S_ISDIR (dst_sb.st_mode) && x->backup_type == no_backups)
|
||||
{
|
||||
error (0, 0, _("cannot overwrite directory %s"),
|
||||
quote (dst_name));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Don't allow user to move a directory onto a non-directory. */
|
||||
if (S_ISDIR (src_sb.st_mode) && !S_ISDIR (dst_sb.st_mode)
|
||||
&& x->backup_type == no_backups)
|
||||
|
||||
Reference in new issue
Block a user