diff options
author | Jim Meyering <jim@meyering.net> | 1998-07-03 20:06:50 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-07-03 20:06:50 +0000 |
commit | 184870f9bb4e7b9874f6dbc73afee525187f7758 (patch) | |
tree | 86b3f1bf68d44ba6fa28499ed7decf574e911042 /src | |
parent | 6ccae5e2d8b22b97045879930d18f91aaadd685a (diff) | |
download | coreutils-184870f9bb4e7b9874f6dbc73afee525187f7758.tar.xz |
(copy_internal): Don't skip test for same file if creating a hardlink
from symlink over a non-symlink while making backups.
Diffstat (limited to 'src')
-rw-r--r-- | src/copy.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/copy.c b/src/copy.c index 163722189..6c563b843 100644 --- a/src/copy.c +++ b/src/copy.c @@ -437,8 +437,12 @@ copy_internal (const char *src_path, const char *dst_path, if (!same /* If we're making a backup, we'll detect the problem case in copy_reg because SRC_PATH will no longer exist. Allowing - the test to be deferred lets cp do some useful things. */ - && x->backup_type == none + the test to be deferred lets cp do some useful things. + But when creating hardlinks and SRC_PATH is a symlink + but DST_PATH is not we must test anyway. */ + && (x->backup_type == none + || (x->hard_link && S_ISLNK (src_sb.st_mode) + && !S_ISLNK (dst_sb.st_mode))) && !x->dereference && (S_ISLNK (dst_sb.st_mode) || S_ISLNK (src_sb.st_mode))) { |