From c78a808c49f1df12254ff9ae5ce32bd450e14df8 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sat, 18 Dec 2010 22:47:16 +1000 Subject: Only check diskspace availability if needs more than zero The amount of diskspace needed for a transaction can be less than zero. Only test this against the available disk space if it is positive, which avoids a comparison being made between signed and unsigned types (-Wsign-compare). Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- lib/libalpm/diskspace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index 97f28ab2..4ac0e496 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -302,7 +302,8 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local) _alpm_log(PM_LOG_DEBUG, "partition %s, needed %ld, cushion %ld, free %ld\n", data->mount_dir, data->max_blocks_needed, cushion, (unsigned long)data->fsp.f_bfree); - if(data->max_blocks_needed + cushion > data->fsp.f_bfree) { + if(data->max_blocks_needed + cushion >= 0 && + (unsigned long)(data->max_blocks_needed + cushion) > data->fsp.f_bfree) { abort = 1; } } -- cgit v1.2.3