diff options
Diffstat (limited to 'libbb/make_directory.c')
-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 | ||