From: Jim Meyering Date: Fri, 22 Sep 2000 20:41:40 +0000 (+0000) Subject: (main): When used with --force, each of the --link and X-Git-Tag: FILEUTILS-4_0_27~14 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=a04e5b9dbc6e233a2cbc79ab81b1c22d9438927e;p=thirdparty%2Fcoreutils.git (main): When used with --force, each of the --link and --symbolic-link options now implies --remove-destination. --- diff --git a/src/cp.c b/src/cp.c index f766baee1a..a95d8dbcbd 100644 --- a/src/cp.c +++ b/src/cp.c @@ -882,6 +882,11 @@ Use `--parents' for the old meaning, and `--no-dereference' for the new.")); x.xstat = stat; } + /* If --force (-f) was specified and we're in link-creation mode, + first remove any existing destination file. */ + if (x.unlink_dest_after_failed_open && (x.hard_link || x.symbolic_link)) + x.unlink_dest_before_opening = 1; + /* Allocate space for remembering copied and created files. */ hash_init (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE);