index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2012-08-11 17:35:12 -0400 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-09-18 08:27:59 -0500 |
commit | de7a5cf346c3ea8c26e43f4f17834af6fc38a13b (patch) | |
tree | f335924b5e2e0b6e0051c8f04c3591b7d18d3cb7 | |
parent | 03f2e2360ab2950675f9cde32ccc93d1753c6541 (diff) |
-rw-r--r-- | src/pacman/query.c | 31 | ||||
-rw-r--r-- | src/pacman/util.c | 5 |
diff --git a/src/pacman/query.c b/src/pacman/query.c index 50b52dd7..ed8bc1b5 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -173,21 +173,12 @@ static int query_fileowner(alpm_list_t *targets) bname = mbasename(filename); dname = mdirname(filename); - /* for files in '/', there is no directory name to match */ - if(strcmp(dname, "") == 0) { - rpath = NULL; - } else { - rpath = realpath(dname, NULL); + rpath = realpath(dname, NULL); - if(!rpath) { - pm_printf(ALPM_LOG_ERROR, _("cannot determine real path for '%s': %s\n"), - filename, strerror(errno)); - free(filename); - free(dname); - free(rpath); - ret++; - continue; - } + if(!dname || !rpath) { + pm_printf(ALPM_LOG_ERROR, _("cannot determine real path for '%s': %s\n"), + filename, strerror(errno)); + goto targcleanup; } free(dname); @@ -206,21 +197,11 @@ static int query_fileowner(alpm_list_t *targets) continue; } - /* for files in '/', there is no directory name to match */ - if(!rpath) { - if(strcmp(pkgfile, bname) == 0) { - print_query_fileowner(filename, info); - found = 1; - break; - } - continue; - } - + /* concatenate our file and the root path */ if(rootlen + 1 + strlen(pkgfile) > PATH_MAX) { pm_printf(ALPM_LOG_ERROR, _("path too long: %s%s\n"), path, pkgfile); continue; } - /* concatenate our file and the root path */ strcpy(path + rootlen, pkgfile); pdname = mdirname(path); diff --git a/src/pacman/util.c b/src/pacman/util.c index 7f7f6a74..2d1b7626 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -244,9 +244,14 @@ char *mdirname(const char *path) if(last != NULL) { /* we found a '/', so terminate our string */ + if(last == ret) { + /* return "/" for root */ + last++; + } *last = '\0'; return ret; } + /* no slash found */ free(ret); return strdup("."); |