cp: 'cp -il A B' no longer fails if user OKs it

* NEWS: Mention the change.
* src/copy.c (copy_internal): Replace the link if the
user has okayed it.
This commit is contained in:
Paul Eggert committed 2018-10-19 12:38:34 -07:00
1 parent 9c3730e601
commit cbc427485e
2 files changed
+7 -3

No files matched your search

+4
View File
@@ -4,6 +4,10 @@ GNU coreutils NEWS -*- outline -*-
** Bug fixes
When B already exists, 'cp -il A B' no longer immediately fails
after asking the user whether to proceed.
[This bug was present in "the beginning".]
df no longer corrupts displayed multibyte characters on macOS.
** New features
+3 -3
View File
@@ -2657,9 +2657,9 @@ copy_internal (char const *src_name, char const *dst_name,
&& !(! CAN_HARDLINK_SYMLINKS && S_ISLNK (src_mode)
&& x->dereference == DEREF_NEVER))
{
if (! create_hard_link (src_name, dst_name,
x->unlink_dest_after_failed_open,
false, dereference))
bool replace = (x->unlink_dest_after_failed_open
|| x->interactive == I_ASK_USER);
if (! create_hard_link (src_name, dst_name, replace, false, dereference))
goto un_backup;
}
else if (S_ISREG (src_mode)