index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2012-02-20 17:00:26 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-02-20 17:00:26 -0600 |
commit | 3849c3aec130601572b9e06b42bb6af5938936de (patch) | |
tree | f298f227f4ff591390e55b4f02812f12312dd5c7 /lib/libalpm/diskspace.c | |
parent | 326c6a8eed60bfd6aa0d653dad722d8637022d68 (diff) | |
parent | 78adb71f20ee335dff49e34d33f04817a40002b6 (diff) |
-rw-r--r-- | lib/libalpm/diskspace.c | 14 |
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index b5c87954..ac7dab00 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -188,8 +188,20 @@ static alpm_mountpoint_t *match_mount_point(const alpm_list_t *mount_points, for(mp = mount_points; mp != NULL; mp = mp->next) { alpm_mountpoint_t *data = mp->data; + /* first, check if the prefix matches */ if(strncmp(data->mount_dir, real_path, data->mount_dir_len) == 0) { - return data; + /* now, the hard work- a file like '/etc/myconfig' shouldn't map to a + * mountpoint '/e', but only '/etc'. If the mountpoint ends in a trailing + * slash, we know we didn't have a mismatch, otherwise we have to do some + * more sanity checks. */ + if(data->mount_dir[data->mount_dir_len - 1] == '/') { + return data; + } else if(strlen(real_path) >= data->mount_dir_len) { + const char next = real_path[data->mount_dir_len]; + if(next == '/' || next == '\0') { + return data; + } + } } } |