]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
install: only attempt to create a target dir once
authorPádraig Brady <P@draigBrady.com>
Sat, 2 Jan 2016 22:14:41 +0000 (22:14 +0000)
committerPádraig Brady <P@draigBrady.com>
Sun, 3 Jan 2016 12:58:39 +0000 (12:58 +0000)
* src/install.c (main): As an optimization, when calling
install_file_in_dir() for each file, only attempt to create
the target directory once, as this is invariant over the loop.

src/install.c

index 6efb29e665ae173fdb69d9da85d36983227caa67..3f0ca74c9dfadf15f940865378da3cce3c9241bc 100644 (file)
@@ -1043,7 +1043,7 @@ main (int argc, char **argv)
           dest_info_init (&x);
           for (i = 0; i < n_files; i++)
             if (! install_file_in_dir (file[i], target_directory, &x,
-                                       mkdir_and_install))
+                                       i == 0 && mkdir_and_install))
               exit_status = EXIT_FAILURE;
         }
     }