summaryrefslogtreecommitdiff
path: root/src/copy.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-01-14 08:51:13 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2022-01-14 14:09:25 -0800
commit95d6754451e68451b1714034c69380d450c8385f (patch)
tree08f2b526844fde0741086fd7f7840d1bca68c148 /src/copy.h
parent43fa191b5a2eb8d1ae28645306689019e81ad7b8 (diff)
downloadcoreutils-95d6754451e68451b1714034c69380d450c8385f.tar.gz
cp: omit unnecessary stat of destination
'cp A B' attempts to open B as a directory, to see whether to write to B/A instead of to B. In the common case where the open fails with ENOENT, do not bother to stat B afterwards since the stat should also fail with ENOENT. * src/copy.c (copy_internal, copy): Change bool arg about nonexistent destination to a 3-way int argument. All callers changed. (copy_internal): Do not bother to stat a destination already known to not exist when following symlinks.
Diffstat (limited to 'src/copy.h')
-rw-r--r--src/copy.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/copy.h b/src/copy.h
index ea5541471..1f1de8673 100644
--- a/src/copy.h
+++ b/src/copy.h
@@ -289,7 +289,7 @@ int rpl_rename (char const *, char const *);
bool copy (char const *src_name, char const *dst_name,
int dst_dirfd, char const *dst_relname,
- bool nonexistent_dst, const struct cp_options *options,
+ int nonexistent_dst, const struct cp_options *options,
bool *copy_into_self, bool *rename_succeeded)
_GL_ATTRIBUTE_NONNULL ((1, 2, 4, 6, 7));