aboutsummaryrefslogtreecommitdiff
path: root/libbb/make_directory.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/make_directory.c')
-rw-r--r--libbb/make_directory.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c
index a6b7c28df..3e171ff02 100644
--- a/libbb/make_directory.c
+++ b/libbb/make_directory.c
@@ -51,11 +51,44 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags)
51 } 51 }
52 52
53 org_mask = cur_mask = (mode_t)-1L; 53 org_mask = cur_mask = (mode_t)-1L;
54#if ENABLE_PLATFORM_MINGW32
55 /* normalise path separators, path is already assumed writable */
56 for (s=path; *s; ++s) {
57 if (*s == '\\') {
58 *s = '/';
59 }
60 }
61#endif
54 s = path; 62 s = path;
55 while (1) { 63 while (1) {
56 c = '\0'; 64 c = '\0';
57 65
58 if (flags & FILEUTILS_RECUR) { /* Get the parent */ 66 if (flags & FILEUTILS_RECUR) { /* Get the parent */
67#if ENABLE_PLATFORM_MINGW32
68 if (s == path && *s && s[1] == ':') {
69 /* skip drive letter */
70 s += 2;
71 }
72 else if (s == path && s[0] == '/' && s[1] == '/' ) {
73 /* skip UNC server and share */
74 int count = 0;
75 s += 2;
76 while (*s) {
77 if (*s == '/') {
78 do {
79 ++s;
80 } while (*s == '/');
81 if (++count == 2) {
82 --s;
83 break;
84 }
85 }
86 else {
87 ++s;
88 }
89 }
90 }
91#endif
59 /* Bypass leading non-'/'s and then subsequent '/'s */ 92 /* Bypass leading non-'/'s and then subsequent '/'s */
60 while (*s) { 93 while (*s) {
61 if (*s == '/') { 94 if (*s == '/') {