[pacman-dev] [PATCH 3/3] diskspace: canonicalize path to download dir
Dave Reisner
dreisner at archlinux.org
Wed May 2 15:47:57 EDT 2012
With lazy loading in place, it's now quite obvious that we aren't
necessarily checking the right mountpoint for necessary download space.
Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
lib/libalpm/diskspace.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index c05de3b..f33261a 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -347,9 +347,17 @@ int _alpm_check_downloadspace(alpm_handle_t *handle, const char *cachedir,
{
alpm_list_t *mount_points;
alpm_mountpoint_t *cachedir_mp;
+ char resolved_cachedir[PATH_MAX];
size_t j;
int error = 0;
+ /* resolve the cachedir path to ensure we check the right mountpoint. We
+ * handle failures silently, and continue to use the possibly unresolved
+ * path. */
+ if(realpath(cachedir, resolved_cachedir) != NULL) {
+ cachedir = resolved_cachedir;
+ }
+
mount_points = mount_point_list(handle);
if(mount_points == NULL) {
_alpm_log(handle, ALPM_LOG_ERROR, _("could not determine filesystem mount points\n"));
--
1.7.10.1
More information about the pacman-dev
mailing list