aboutsummaryrefslogtreecommitdiff
path: root/libbb/simplify_path.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/simplify_path.c')
-rw-r--r--libbb/simplify_path.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libbb/simplify_path.c b/libbb/simplify_path.c
index 3818d32be..89dc5bdf2 100644
--- a/libbb/simplify_path.c
+++ b/libbb/simplify_path.c
@@ -15,17 +15,17 @@ char* FAST_FUNC bb_simplify_abs_path_inplace(char *start)
15 p = s = start; 15 p = s = start;
16 do { 16 do {
17 if (*p == '/') { 17 if (*p == '/') {
18 if (*s == '/') { /* skip duplicate (or initial) slash */ 18 if (*s == '/') { /* skip duplicate (or initial) slash */
19 continue; 19 continue;
20 } 20 }
21 if (*s == '.') { 21 if (*s == '.') {
22 if (s[1] == '/' || !s[1]) { /* remove extra '.' */ 22 if (s[1] == '/' || !s[1]) { /* remove extra '.' */
23 continue; 23 continue;
24 } 24 }
25 if ((s[1] == '.') && (s[2] == '/' || !s[2])) { 25 if ((s[1] == '.') && (s[2] == '/' || !s[2])) {
26 ++s; 26 ++s;
27 if (p > start) { 27 if (p > start) {
28 while (*--p != '/') /* omit previous dir */ 28 while (*--p != '/') /* omit previous dir */
29 continue; 29 continue;
30 } 30 }
31 continue; 31 continue;
@@ -35,8 +35,8 @@ char* FAST_FUNC bb_simplify_abs_path_inplace(char *start)
35 *++p = *s; 35 *++p = *s;
36 } while (*++s); 36 } while (*++s);
37 37
38 if ((p == start) || (*p != '/')) { /* not a trailing slash */ 38 if ((p == start) || (*p != '/')) { /* not a trailing slash */
39 ++p; /* so keep last character */ 39 ++p; /* so keep last character */
40 } 40 }
41 *p = '\0'; 41 *p = '\0';
42 return p; 42 return p;