From 16abcd90aefae8bdb9f7d80a555982dba6ca59b5 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Fri, 13 Apr 2007 23:59:52 +0000 Subject: teach find_root_device to deal with /dev/ subdirs (by "Kirill K. Smirnov" ) --- libbb/simplify_path.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libbb/simplify_path.c') 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) 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; } -- cgit v1.2.3