[pacman-dev] Checking free space before transaction
Nezmer
git at nezmer.info
Thu Nov 11 15:46:44 CET 2010
On Thu, Nov 11, 2010 at 09:09:27AM +1000, Allan McRae wrote:
> On 11/11/10 07:29, Nezmer wrote:
> >But with those changes pacman did not like my ZFS pool.
>
> From a bit of google, it looks like the statvfs call is probably
> returning EOVERFLOW on that so we can probably just assume LOTS of
> space and move on in those conditions...
>
> Allan
>
>
That's over-simplification. This is the quick patch I needed to make
this even compile.
-------------- next part --------------
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index 51c25ed..f382d3c 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -80,7 +80,7 @@ static alpm_list_t *mount_point_list()
endmntent(fp);
#elif defined HAVE_GETMNTINFO
int entries;
- struct statvfs *fsp;
+ struct statfs *fsp;
entries = getmntinfo(&fsp, MNT_NOWAIT);
@@ -89,12 +89,12 @@ static alpm_list_t *mount_point_list()
}
for(; entries-- > 0; fsp++) {
- if((&fsp)->f_bfree != 0) {
+ if(fsp->f_bfree != 0) {
MALLOC(mp, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
- mp->mount_dir = strdup(fsp->f_mntonname)
+ mp->mount_dir = strdup(fsp->f_mntonname);
- MALLOC(mp->fsp, sizeof(struct statvfs), RET_ERR(PM_ERR_MEMORY, NULL));
- memcpy((void *)(mp->fsp), (void *)fsp, sizeof(struct statvfs));
+ MALLOC(mp->fsp, sizeof(struct statfs), RET_ERR(PM_ERR_MEMORY, NULL));
+ memcpy((void *)(mp->fsp), (void *)fsp, sizeof(struct statfs));
mp->blocks_needed = 0;
mp->max_blocks_needed = 0;
More information about the pacman-dev
mailing list