process the "./" in file paths correctly (rhbz#491388)
This commit is contained in:
parent
5f445d7e8f
commit
4d31b0433f
|
@ -426,11 +426,19 @@ 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] == '/')) {
|
||||
/* 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')) {
|
||||
t = te;
|
||||
|
|
Loading…
Reference in New Issue