svn commit: trunk/busybox/coreutils

vda at busybox.net vda at busybox.net
Sat Sep 6 14:35:09 UTC 2008


Author: vda
Date: 2008-09-06 07:35:08 -0700 (Sat, 06 Sep 2008)
New Revision: 23334

Log:
install: shrink -D code. By Bernhard.

function                                             old     new   delta
install_main                                         726     707     -19



Modified:
   trunk/busybox/coreutils/install.c


Changeset:
Modified: trunk/busybox/coreutils/install.c
===================================================================
--- trunk/busybox/coreutils/install.c	2008-09-06 14:14:01 UTC (rev 23333)
+++ trunk/busybox/coreutils/install.c	2008-09-06 14:35:08 UTC (rev 23334)
@@ -159,18 +159,15 @@
 				goto next;
 			}
 		} else {
-			if (isdir)
-				dest = concat_path_file(last, basename(arg));
 			if (opts & OPT_MKDIR_LEADING) {
-				char *slash = strrchr(dest, '/');
-				if (slash) {
-					*slash = '\0';
-					bb_make_directory(dest, 0755, FILEUTILS_RECUR);
-					/* errors are not checked. copy_file
-					 * will fail if dir is not created. */
-					*slash = '/';
-				}
+				char *ddir = xstrdup(dest);
+				bb_make_directory(dirname(ddir), 0755, FILEUTILS_RECUR);
+				/* errors are not checked. copy_file
+				 * will fail if dir is not created. */
+				free(ddir);
 			}
+			if (isdir)
+				dest = concat_path_file(last, basename(arg));
 			if (copy_file(arg, dest, copy_flags)) {
 				/* copy is not made */
 				ret = EXIT_FAILURE;




More information about the busybox-cvs mailing list