teach find_root_device to deal with /dev/ subdirs
(by "Kirill K. Smirnov" <lich@math.spbu.ru>)
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 @@
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;
}