summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko2016-12-04 10:42:07 +0100
committerDenys Vlasenko2016-12-04 10:42:07 +0100
commit4bd0c2ab38a53d5ecc89eacc61b3291d4fe01d51 (patch)
treebcba1c6bbae7988c0fe2b8f5375e8b5050a254c4 /coreutils
parentfdb4421e00cc5115cffb55aac79c709a3a5108dd (diff)
downloadbusybox-4bd0c2ab38a53d5ecc89eacc61b3291d4fe01d51.zip
busybox-4bd0c2ab38a53d5ecc89eacc61b3291d4fe01d51.tar.gz
fix musl problem with dirname, now for all users of bb_make_directory()
function old new delta bb_make_directory 412 419 +7 install_main 793 769 -24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-24) Total: -17 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/install.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/coreutils/install.c b/coreutils/install.c
index d0dcd0e..831f9b8 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -209,16 +209,10 @@ int install_main(int argc, char **argv)
dest = last;
if (opts & OPT_MKDIR_LEADING) {
char *ddir = xstrdup(dest);
- char *dn = dirname(ddir);
- /* musl can return read-only "/" or "." string.
- * bb_make_directory needs writable string.
+ bb_make_directory(dirname(ddir), 0755, mkdir_flags);
+ /* errors are not checked. copy_file
+ * will fail if dir is not created.
*/
- if ((dn[0] != '/' && dn[0] != '.') || dn[1] != '\0') {
- bb_make_directory(dn, 0755, mkdir_flags);
- /* errors are not checked. copy_file
- * will fail if dir is not created.
- */
- }
free(ddir);
}
if (isdir)