summaryrefslogtreecommitdiff
path: root/libbb/simplify_path.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-04-13 23:59:52 +0000
committerDenis Vlasenko2007-04-13 23:59:52 +0000
commit16abcd90aefae8bdb9f7d80a555982dba6ca59b5 (patch)
treeb7e23fd3c844849d188813323076c93105a57d4d /libbb/simplify_path.c
parent334fa9bcb50df9a03288be252096750dcec14404 (diff)
downloadbusybox-16abcd90aefae8bdb9f7d80a555982dba6ca59b5.zip
busybox-16abcd90aefae8bdb9f7d80a555982dba6ca59b5.tar.gz
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 7e68e39..29e371d 100644
--- a/libbb/simplify_path.c
+++ b/libbb/simplify_path.c
@@ -26,13 +26,16 @@ char *bb_simplify_path(const char *path)
if (*p == '/') {
if (*s == '/') { /* skip duplicate (or initial) slash */
continue;
- } else if (*s == '.') {
- if (s[1] == '/' || s[1] == 0) { /* remove extra '.' */
+ }
+ if (*s == '.') {
+ if (s[1] == '/' || !s[1]) { /* remove extra '.' */
continue;
- } else if ((s[1] == '.') && (s[2] == '/' || s[2] == 0)) {
+ }
+ if ((s[1] == '.') && (s[2] == '/' || !s[2])) {
++s;
if (p > start) {
- while (*--p != '/'); /* omit previous dir */
+ while (*--p != '/') /* omit previous dir */
+ continue;
}
continue;
}