diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-12-03 11:49:23 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-12-03 11:49:23 +0100 |
commit | cf2600c3661c11491a838ef29733583afb6ad968 (patch) | |
tree | f908ec99c481718fa2075dbd1917a7a9edb0a878 /coreutils | |
parent | 7d877fc9312a742b06125927bb1d34bd35398c6c (diff) | |
download | busybox-w32-cf2600c3661c11491a838ef29733583afb6ad968.tar.gz busybox-w32-cf2600c3661c11491a838ef29733583afb6ad968.tar.bz2 busybox-w32-cf2600c3661c11491a838ef29733583afb6ad968.zip |
install: fix musl problem with dirname
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/install.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/coreutils/install.c b/coreutils/install.c index e68589229..d0dcd0e89 100644 --- a/coreutils/install.c +++ b/coreutils/install.c | |||
@@ -209,9 +209,16 @@ int install_main(int argc, char **argv) | |||
209 | dest = last; | 209 | dest = last; |
210 | if (opts & OPT_MKDIR_LEADING) { | 210 | if (opts & OPT_MKDIR_LEADING) { |
211 | char *ddir = xstrdup(dest); | 211 | char *ddir = xstrdup(dest); |
212 | bb_make_directory(dirname(ddir), 0755, mkdir_flags); | 212 | char *dn = dirname(ddir); |
213 | /* errors are not checked. copy_file | 213 | /* musl can return read-only "/" or "." string. |
214 | * will fail if dir is not created. */ | 214 | * bb_make_directory needs writable string. |
215 | */ | ||
216 | if ((dn[0] != '/' && dn[0] != '.') || dn[1] != '\0') { | ||
217 | bb_make_directory(dn, 0755, mkdir_flags); | ||
218 | /* errors are not checked. copy_file | ||
219 | * will fail if dir is not created. | ||
220 | */ | ||
221 | } | ||
215 | free(ddir); | 222 | free(ddir); |
216 | } | 223 | } |
217 | if (isdir) | 224 | if (isdir) |