diff options
Diffstat (limited to 'coreutils')
| -rw-r--r-- | coreutils/install.c | 17 |
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) | |||
| 159 | goto next; | 159 | goto next; |
| 160 | } | 160 | } |
| 161 | } else { | 161 | } else { |
| 162 | if (isdir) | ||
| 163 | dest = concat_path_file(last, basename(arg)); | ||
| 164 | if (opts & OPT_MKDIR_LEADING) { | 162 | if (opts & OPT_MKDIR_LEADING) { |
| 165 | char *slash = strrchr(dest, '/'); | 163 | char *ddir = xstrdup(dest); |
| 166 | if (slash) { | 164 | bb_make_directory(dirname(ddir), 0755, FILEUTILS_RECUR); |
| 167 | *slash = '\0'; | 165 | /* errors are not checked. copy_file |
| 168 | bb_make_directory(dest, 0755, FILEUTILS_RECUR); | 166 | * will fail if dir is not created. */ |
| 169 | /* errors are not checked. copy_file | 167 | free(ddir); |
| 170 | * will fail if dir is not created. */ | ||
| 171 | *slash = '/'; | ||
| 172 | } | ||
| 173 | } | 168 | } |
| 169 | if (isdir) | ||
| 170 | dest = concat_path_file(last, basename(arg)); | ||
| 174 | if (copy_file(arg, dest, copy_flags)) { | 171 | if (copy_file(arg, dest, copy_flags)) { |
| 175 | /* copy is not made */ | 172 | /* copy is not made */ |
| 176 | ret = EXIT_FAILURE; | 173 | ret = EXIT_FAILURE; |
