From 607f01b2f52ea2625bd6bc347e7080eb7416c8dd Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 14 Jul 2014 10:09:34 +0200 Subject: [PATCH] If statvfs() fails don't consider this a critical error; compute free space correctly. --- lib/transaction_dictionary.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/transaction_dictionary.c b/lib/transaction_dictionary.c index 0ed4835f..db166703 100644 --- a/lib/transaction_dictionary.c +++ b/lib/transaction_dictionary.c @@ -171,10 +171,10 @@ compute_transaction_stats(struct xbps_handle *xhp) /* Get free space from target rootdir: return ENOSPC if there's not enough space */ if (statvfs(xhp->rootdir, &svfs) == -1) { xbps_dbg_printf(xhp, "%s: statvfs failed: %s\n", __func__, strerror(errno)); - return EINVAL; + return 0; } /* compute free space on disk */ - rootdir_free_size = svfs.f_bfree * svfs.f_bsize - instsize; + rootdir_free_size = svfs.f_bavail * svfs.f_bsize - instsize; if (!xbps_dictionary_set_uint64(xhp->transd, "disk-free-size", rootdir_free_size))