From: Jindrich Novy Date: Wed, 25 Mar 2009 16:28:24 +0000 (+0100) Subject: process the "./" in file paths correctly (rhbz#491388) X-Git-Tag: rpm-4.8.0-beta1~559 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4d31b0433f3f804f81955c32e63c93f31506e8ad;p=platform%2Fupstream%2Frpm.git process the "./" in file paths correctly (rhbz#491388) --- diff --git a/rpmio/rpmfileutil.c b/rpmio/rpmfileutil.c index 92685bc..060d0c1 100644 --- a/rpmio/rpmfileutil.c +++ b/rpmio/rpmfileutil.c @@ -426,10 +426,18 @@ char *rpmCleanPath(char * path) if (begin && s[1] == '\0') { break; } - /* Trim embedded ./ , trailing /. */ - if ((t[-1] == '/' && s[1] == '\0') || (t > path && t[-1] == '/' && s[1] == '/')) { - s++; - continue; + /* Handle the ./ cases */ + if (t > path && t[-1] == '/') { + /* Trim embedded ./ */ + if (s[1] == '/') { + s+=2; + continue; + } + /* Trim trailing /. */ + if (s[1] == '\0') { + s++; + continue; + } } /* Trim embedded /../ and trailing /.. */ if (!begin && t > path && t[-1] == '/' && s[1] == '.' && (s[2] == '/' || s[2] == '\0')) {