diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-04-22 22:26:12 +1000 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-04-23 04:44:36 +1000 |
commit | 71aa9b002bacf3b32342cf5a319a4cd1a372feba (patch) | |
tree | 8f52f32194671f8cf0f962269b844a466c6b838c | |
parent | fb12d06216cf3453ce34137280f88330a8ca0d03 (diff) | |
download | busybox-w32-71aa9b002bacf3b32342cf5a319a4cd1a372feba.tar.gz busybox-w32-71aa9b002bacf3b32342cf5a319a4cd1a372feba.tar.bz2 busybox-w32-71aa9b002bacf3b32342cf5a319a4cd1a372feba.zip |
libbb/bb_make_directory() remove trailing slashes before passing to mkdir() because Windows does not like it
-rw-r--r-- | libbb/make_directory.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c index d540ad133..b8da09901 100644 --- a/libbb/make_directory.c +++ b/libbb/make_directory.c | |||
@@ -30,7 +30,7 @@ int bb_make_directory (char *path, long mode, int flags) | |||
30 | { | 30 | { |
31 | mode_t mask; | 31 | mode_t mask; |
32 | const char *fail_msg; | 32 | const char *fail_msg; |
33 | char *s = path; | 33 | char *s = path,*s2; |
34 | char c; | 34 | char c; |
35 | struct stat st; | 35 | struct stat st; |
36 | 36 | ||
@@ -51,11 +51,12 @@ int bb_make_directory (char *path, long mode, int flags) | |||
51 | /* Bypass leading non-'/'s and then subsequent '/'s. */ | 51 | /* Bypass leading non-'/'s and then subsequent '/'s. */ |
52 | while (*s) { | 52 | while (*s) { |
53 | if (*s == '/') { | 53 | if (*s == '/') { |
54 | s2 = s; | ||
55 | c = *s2; /* Save the current char */ | ||
56 | *s2 = 0; /* and replace it with nul. */ | ||
54 | do { | 57 | do { |
55 | ++s; | 58 | ++s; |
56 | } while (*s == '/'); | 59 | } while (*s == '/'); |
57 | c = *s; /* Save the current char */ | ||
58 | *s = 0; /* and replace it with nul. */ | ||
59 | break; | 60 | break; |
60 | } | 61 | } |
61 | ++s; | 62 | ++s; |
@@ -94,7 +95,7 @@ int bb_make_directory (char *path, long mode, int flags) | |||
94 | } | 95 | } |
95 | 96 | ||
96 | /* Remove any inserted nul from the path (recursive mode). */ | 97 | /* Remove any inserted nul from the path (recursive mode). */ |
97 | *s = c; | 98 | *s2 = c; |
98 | 99 | ||
99 | } while (1); | 100 | } while (1); |
100 | 101 | ||