diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2012-08-11 23:35:12 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-09-18 15:27:59 +0200 |
commit | de7a5cf346c3ea8c26e43f4f17834af6fc38a13b (patch) | |
tree | f335924b5e2e0b6e0051c8f04c3591b7d18d3cb7 /src/pacman/util.c | |
parent | 03f2e2360ab2950675f9cde32ccc93d1753c6541 (diff) | |
download | pacman-de7a5cf346c3ea8c26e43f4f17834af6fc38a13b.tar.gz pacman-de7a5cf346c3ea8c26e43f4f17834af6fc38a13b.tar.xz |
query_fileowner: remove assumption that root is "/"
Returning "/" from mdirname removes it as a special case which allows us to
test it like any other directory. This corrects a false positive when querying
a file in / and root is not set to /.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Diffstat (limited to 'src/pacman/util.c')
-rw-r--r-- | src/pacman/util.c | 5 |
1 files changed, 5 insertions, 0 deletions
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("."); |