diff options
author | Ron Yorston <rmy@pobox.com> | 2013-08-27 12:56:40 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2013-08-27 12:56:40 +0100 |
commit | e3ac39098326de084a805d0dd31db9666b734f20 (patch) | |
tree | dbe8094a99bd46b0bce66032e67a7832a22220c8 | |
parent | 6392ae0444fe13ea0e62021247bf0dcab5bc7f23 (diff) | |
download | busybox-w32-e3ac39098326de084a805d0dd31db9666b734f20.tar.gz busybox-w32-e3ac39098326de084a805d0dd31db9666b734f20.tar.bz2 busybox-w32-e3ac39098326de084a805d0dd31db9666b734f20.zip |
libbb: handle UNC paths in recursive make directory calls
-rw-r--r-- | libbb/make_directory.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c index 39599b657..1f874f1f2 100644 --- a/libbb/make_directory.c +++ b/libbb/make_directory.c | |||
@@ -45,10 +45,31 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags) | |||
45 | c = '\0'; | 45 | c = '\0'; |
46 | 46 | ||
47 | if (flags & FILEUTILS_RECUR) { /* Get the parent */ | 47 | if (flags & FILEUTILS_RECUR) { /* Get the parent */ |
48 | /* skip drive letter */ | 48 | #if ENABLE_PLATFORM_MINGW32 |
49 | if (ENABLE_PLATFORM_MINGW32 && s == path && *s && s[1] == ':') { | 49 | if (s == path && *s && s[1] == ':') { |
50 | /* skip drive letter */ | ||
50 | s += 2; | 51 | s += 2; |
51 | } | 52 | } |
53 | else if (s == path && s[0] == '/' && s[1] == '/' ) { | ||
54 | /* skip UNC server and share */ | ||
55 | int count = 0; | ||
56 | s += 2; | ||
57 | while (*s) { | ||
58 | if (*s == '/') { | ||
59 | do { | ||
60 | ++s; | ||
61 | } while (*s == '/'); | ||
62 | if (++count == 2) { | ||
63 | --s; | ||
64 | break; | ||
65 | } | ||
66 | } | ||
67 | else { | ||
68 | ++s; | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | #endif | ||
52 | /* Bypass leading non-'/'s and then subsequent '/'s */ | 73 | /* Bypass leading non-'/'s and then subsequent '/'s */ |
53 | while (*s) { | 74 | while (*s) { |
54 | if (*s == '/') { | 75 | if (*s == '/') { |