diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-05 22:24:35 +0200 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-10 19:28:29 +1000 |
commit | 9b680f4959a4a54fc2702663922f201b145acdd1 (patch) | |
tree | 207db32c126ee7de16750827e2e15d5728c84599 | |
parent | cfa3601de004a23cd1a4de9ddbbbd4c7fd7db21c (diff) | |
download | busybox-w32-9b680f4959a4a54fc2702663922f201b145acdd1.tar.gz busybox-w32-9b680f4959a4a54fc2702663922f201b145acdd1.tar.bz2 busybox-w32-9b680f4959a4a54fc2702663922f201b145acdd1.zip |
win32: make_directory: drive letter support (buggy)
-rw-r--r-- | libbb/make_directory.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c index 4486eb1ed..1eb8a8a49 100644 --- a/libbb/make_directory.c +++ b/libbb/make_directory.c | |||
@@ -31,7 +31,7 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags) | |||
31 | mode_t cur_mask; | 31 | mode_t cur_mask; |
32 | mode_t org_mask; | 32 | mode_t org_mask; |
33 | const char *fail_msg; | 33 | const char *fail_msg; |
34 | char *s; | 34 | char *s, *s2; |
35 | char c; | 35 | char c; |
36 | struct stat st; | 36 | struct stat st; |
37 | 37 | ||
@@ -45,14 +45,21 @@ 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 and initial slashes */ | ||
49 | if (ENABLE_PLATFORM_MINGW32 && s == path && *s && s[1] == ':') { | ||
50 | s += 2; | ||
51 | while (*s == '/') | ||
52 | s++; | ||
53 | } | ||
48 | /* Bypass leading non-'/'s and then subsequent '/'s */ | 54 | /* Bypass leading non-'/'s and then subsequent '/'s */ |
49 | while (*s) { | 55 | while (*s) { |
50 | if (*s == '/') { | 56 | if (*s == '/') { |
57 | s2 = s; | ||
58 | c = *s2; /* Save the current char */ | ||
59 | *s2 = 0; /* and replace it with nul. */ | ||
51 | do { | 60 | do { |
52 | ++s; | 61 | ++s; |
53 | } while (*s == '/'); | 62 | } while (*s == '/'); |
54 | c = *s; /* Save the current char */ | ||
55 | *s = '\0'; /* and replace it with nul */ | ||
56 | break; | 63 | break; |
57 | } | 64 | } |
58 | ++s; | 65 | ++s; |
@@ -113,7 +120,7 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags) | |||
113 | } | 120 | } |
114 | 121 | ||
115 | /* Remove any inserted nul from the path (recursive mode) */ | 122 | /* Remove any inserted nul from the path (recursive mode) */ |
116 | *s = c; | 123 | *s2 = c; |
117 | } /* while (1) */ | 124 | } /* while (1) */ |
118 | 125 | ||
119 | bb_perror_msg("can't %s directory '%s'", fail_msg, path); | 126 | bb_perror_msg("can't %s directory '%s'", fail_msg, path); |