From a66a4b77a558c340a925e6492cf3acd5cd643445 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Sep 2023 09:10:21 -0700 Subject: [PATCH] cp,mv,install: minor copy_internal refactoring * src/copy.c (copy_internal): Redo to avoid need for calculating fstatat_flags when not needed. This is for clarity, not speed. --- src/copy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/copy.c b/src/copy.c index 18945a494b..75cd7f081b 100644 --- a/src/copy.c +++ b/src/copy.c @@ -2309,11 +2309,10 @@ copy_internal (char const *src_name, char const *dst_name, || x->move_mode || x->symbolic_link || x->hard_link || x->backup_type != no_backups || x->unlink_dest_before_opening); - int fstatat_flags = use_lstat ? AT_SYMLINK_NOFOLLOW : 0; if (!use_lstat && nonexistent_dst < 0) new_dst = true; - else if (follow_fstatat (dst_dirfd, drelname, &dst_sb, fstatat_flags) - == 0) + else if (0 <= follow_fstatat (dst_dirfd, drelname, &dst_sb, + use_lstat ? AT_SYMLINK_NOFOLLOW : 0)) { have_dst_lstat = use_lstat; rename_errno = EEXIST; -- 2.47.2