summaryrefslogtreecommitdiffhomepage
path: root/coreutils/install.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-09-06 14:35:08 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-09-06 14:35:08 +0000
commit9f9c1935fa6df1431e54792d67b928bf157a6d36 (patch)
tree04a108c2b426ec0778f64788e4879b165db528a1 /coreutils/install.c
parent1c781cc8fffa64ae59438bf653994cf908ba2b35 (diff)
install: shrink -D code. By Bernhard.
function old new delta install_main 726 707 -19
Diffstat (limited to 'coreutils/install.c')
-rw-r--r--coreutils/install.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/coreutils/install.c b/coreutils/install.c
index 69bf7dc55..2b796e2a1 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -159,18 +159,15 @@ int install_main(int argc, char **argv)
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;