aboutsummaryrefslogtreecommitdiff
path: root/libbb/simplify_path.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-04-13 23:59:52 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-04-13 23:59:52 +0000
commit16abcd90aefae8bdb9f7d80a555982dba6ca59b5 (patch)
treeb7e23fd3c844849d188813323076c93105a57d4d /libbb/simplify_path.c
parent334fa9bcb50df9a03288be252096750dcec14404 (diff)
downloadbusybox-w32-16abcd90aefae8bdb9f7d80a555982dba6ca59b5.tar.gz
busybox-w32-16abcd90aefae8bdb9f7d80a555982dba6ca59b5.tar.bz2
busybox-w32-16abcd90aefae8bdb9f7d80a555982dba6ca59b5.zip
teach find_root_device to deal with /dev/ subdirs
(by "Kirill K. Smirnov" <lich@math.spbu.ru>)
Diffstat (limited to 'libbb/simplify_path.c')
-rw-r--r--libbb/simplify_path.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libbb/simplify_path.c b/libbb/simplify_path.c
index 7e68e3911..29e371df6 100644
--- a/libbb/simplify_path.c
+++ b/libbb/simplify_path.c
@@ -26,13 +26,16 @@ char *bb_simplify_path(const char *path)
26 if (*p == '/') { 26 if (*p == '/') {
27 if (*s == '/') { /* skip duplicate (or initial) slash */ 27 if (*s == '/') { /* skip duplicate (or initial) slash */
28 continue; 28 continue;
29 } else if (*s == '.') { 29 }
30 if (s[1] == '/' || s[1] == 0) { /* remove extra '.' */ 30 if (*s == '.') {
31 if (s[1] == '/' || !s[1]) { /* remove extra '.' */
31 continue; 32 continue;
32 } else if ((s[1] == '.') && (s[2] == '/' || s[2] == 0)) { 33 }
34 if ((s[1] == '.') && (s[2] == '/' || !s[2])) {
33 ++s; 35 ++s;
34 if (p > start) { 36 if (p > start) {
35 while (*--p != '/'); /* omit previous dir */ 37 while (*--p != '/') /* omit previous dir */
38 continue;
36 } 39 }
37 continue; 40 continue;
38 } 41 }