summaryrefslogtreecommitdiff
path: root/rpmio/rpmfileutil.c
diff options
context:
space:
mode:
authorJindrich Novy <jnovy@redhat.com>2009-03-25 17:28:24 +0100
committerJindrich Novy <jnovy@redhat.com>2009-03-25 17:28:55 +0100
commit4d31b0433f3f804f81955c32e63c93f31506e8ad (patch)
treefa25dfbbe7fa3bb40701214ec2a66b5eecab8e75 /rpmio/rpmfileutil.c
parent5f445d7e8f14df6976b9fa19e9caf4a0dfbcbebb (diff)
downloadlibrpm-tizen-4d31b0433f3f804f81955c32e63c93f31506e8ad.tar.gz
librpm-tizen-4d31b0433f3f804f81955c32e63c93f31506e8ad.tar.bz2
librpm-tizen-4d31b0433f3f804f81955c32e63c93f31506e8ad.zip
process the "./" in file paths correctly (rhbz#491388)
Diffstat (limited to 'rpmio/rpmfileutil.c')
-rw-r--r--rpmio/rpmfileutil.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/rpmio/rpmfileutil.c b/rpmio/rpmfileutil.c
index 92685bc56..060d0c1d7 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')) {