diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-12-04 10:42:07 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-12-04 10:42:07 +0100 |
commit | 4bd0c2ab38a53d5ecc89eacc61b3291d4fe01d51 (patch) | |
tree | bcba1c6bbae7988c0fe2b8f5375e8b5050a254c4 /libbb | |
parent | fdb4421e00cc5115cffb55aac79c709a3a5108dd (diff) | |
download | busybox-w32-4bd0c2ab38a53d5ecc89eacc61b3291d4fe01d51.tar.gz busybox-w32-4bd0c2ab38a53d5ecc89eacc61b3291d4fe01d51.tar.bz2 busybox-w32-4bd0c2ab38a53d5ecc89eacc61b3291d4fe01d51.zip |
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 'libbb')
-rw-r--r-- | libbb/make_directory.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c index 89352ca1f..a6b7c28df 100644 --- a/libbb/make_directory.c +++ b/libbb/make_directory.c | |||
@@ -35,9 +35,20 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags) | |||
35 | char c; | 35 | char c; |
36 | struct stat st; | 36 | struct stat st; |
37 | 37 | ||
38 | /* Happens on bb_make_directory(dirname("no_slashes"),...) */ | 38 | /* "path" can be a result of dirname(). |
39 | if (LONE_CHAR(path, '.')) | 39 | * dirname("no_slashes") returns ".", possibly read-only. |
40 | * musl dirname() can return read-only "/" too. | ||
41 | * We need writable string. And for "/", "." (and ".."?) | ||
42 | * nothing needs to be created anyway. | ||
43 | */ | ||
44 | if (LONE_CHAR(path, '/')) | ||
40 | return 0; | 45 | return 0; |
46 | if (path[0] == '.') { | ||
47 | if (path[1] == '\0') | ||
48 | return 0; /* "." */ | ||
49 | // if (path[1] == '.' && path[2] == '\0') | ||
50 | // return 0; /* ".." */ | ||
51 | } | ||
41 | 52 | ||
42 | org_mask = cur_mask = (mode_t)-1L; | 53 | org_mask = cur_mask = (mode_t)-1L; |
43 | s = path; | 54 | s = path; |