index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2012-02-19 23:04:12 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-02-19 23:04:12 -0600 |
commit | 4899b5bd864919830fe4ce5786d37a00ab5a0da3 (patch) | |
tree | 4355a3336d8b6ec8c0085748ac2152cd25659eb4 | |
parent | ca4142714137b16feabac09c4cda86b0a75036f8 (diff) |
-rw-r--r-- | lib/libalpm/diskspace.c | 14 |
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index d0f52a63..45908b22 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -179,8 +179,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; + } + } } } |