From f39a02a744ae97f6879ba1d20a528192772773e0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 14 Jan 2022 15:17:17 -0800 Subject: [PATCH] cp: fix two typos in previous change MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Somehow ‘make check’ didn’t catch these the first few times. * src/copy.c (copy_dir): Don’t pass null pointer to copy_internal where it now expects non-null if move mode. * src/cp.c (make_dir_parents_private): Initialize *attr_list before recentely-added quick return. --- src/copy.c | 3 ++- src/cp.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/copy.c b/src/copy.c index fccb20f95e..a6be843ec6 100644 --- a/src/copy.c +++ b/src/copy.c @@ -797,13 +797,14 @@ copy_dir (char const *src_name_in, char const *dst_name_in, char *src_name = file_name_concat (src_name_in, namep, NULL); char *dst_name = file_name_concat (dst_name_in, namep, NULL); bool first_dir_created = *first_dir_created_per_command_line_arg; + bool rename_succeeded; ok &= copy_internal (src_name, dst_name, dst_dirfd, dst_name + (dst_relname_in - dst_name_in), new_dst, src_sb, ancestors, &non_command_line_options, false, &first_dir_created, - &local_copy_into_self, NULL); + &local_copy_into_self, &rename_succeeded); *copy_into_self |= local_copy_into_self; free (dst_name); diff --git a/src/cp.c b/src/cp.c index db15f0d3bd..9aa5c36753 100644 --- a/src/cp.c +++ b/src/cp.c @@ -371,6 +371,8 @@ make_dir_parents_private (char const *const_dir, size_t src_offset, char *dst_dir; /* Leading directory of DIR. */ idx_t dirlen = dir_len (const_dir); + *attr_list = NULL; + /* Succeed immediately if the parent of CONST_DIR must already exist, as the target directory has already been checked. */ if (dirlen <= src_offset) @@ -387,8 +389,6 @@ make_dir_parents_private (char const *const_dir, size_t src_offset, while (*dst_reldir == '/') dst_reldir++; - *attr_list = NULL; - /* XXX: If all dirs are present at the destination, no permissions or security contexts will be updated. */ if (statat (dst_dirfd, dst_reldir, &stats) != 0) -- 2.47.2