]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cp: fix two typos in previous change
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 14 Jan 2022 23:17:17 +0000 (15:17 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 14 Jan 2022 23:17:54 +0000 (15:17 -0800)
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
src/cp.c

index fccb20f95e4bfe33b8bc90ae5cd791f324bf16b1..a6be843ec691dc896b8718ec35441a26f1db5ebe 100644 (file)
@@ -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);
index db15f0d3bde52dec2f76341459ffe75fade89890..9aa5c367534aedca791a669330d3efcf9e08ce67 100644 (file)
--- 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)