From ed13ac2cc8dd15d8a19d769cc77941ad18ac1a7c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 2 Jun 2007 13:17:26 -0400 Subject: Remove freespace checking code This code depends on /etc/mtab existance, which is not very reliable in all cases, especially in a chroot or non-Linux environment. Dump it for now until we can find a better way. Signed-off-by: Dan McGee --- lib/libalpm/trans.c | 79 ----------------------------------------------------- 1 file changed, 79 deletions(-) (limited to 'lib/libalpm/trans.c') diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 2637197c..3c6a0c3d 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -540,85 +540,6 @@ cleanup: return(retval); } -#ifndef __sun__ -static long long get_freespace() -{ - struct mntent *mnt; - const char *table = MOUNTED; - FILE *fp; - long long ret=0; - - if((fp = setmntent(table, "r")) == NULL) { - _alpm_log(PM_LOG_ERROR, _("cannot read disk space information from %s: %s"), - table, strerror(errno)); - return(-1); - } - - while ((mnt = getmntent(fp))) - { - struct statvfs64 buf; - - statvfs64(mnt->mnt_dir, &buf); - ret += buf.f_bavail * buf.f_bsize; - } - - endmntent(fp); - - return(ret); -} - -int _alpm_check_freespace(pmtrans_t *trans, alpm_list_t **data) -{ - alpm_list_t *i; - long long pkgsize=0, freespace; - - ALPM_LOG_FUNC; - - for(i = trans->packages; i; i = i->next) { - if(trans->type == PM_TRANS_TYPE_SYNC) - { - pmsyncpkg_t *sync = i->data; - if(sync->type != PM_SYNC_TYPE_REPLACE) { - pmpkg_t *pkg = sync->pkg; - pkgsize += alpm_pkg_get_isize(pkg); - } - } - else - { - pmpkg_t *pkg = i->data; - pkgsize += alpm_pkg_get_size(pkg); - } - } - freespace = get_freespace(); - _alpm_log(PM_LOG_DEBUG, _("check_freespace: total pkg size: %lld, disk space: %lld"), pkgsize, freespace); - if(pkgsize > freespace) { - if(data) { - long long *ptr; - if((ptr = malloc(sizeof(long long)))==NULL) { - _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(long long)); - pm_errno = PM_ERR_MEMORY; - return(-1); - } - *ptr = pkgsize; - *data = alpm_list_add(*data, ptr); - if((ptr = malloc(sizeof(long long)))==NULL) { - _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(long long)); - FREELIST(*data); - pm_errno = PM_ERR_MEMORY; - return(-1); - } - *ptr = freespace; - *data = alpm_list_add(*data, ptr); - } - pm_errno = PM_ERR_DISK_FULL; - return(-1); - } - else { - return(0); - } -} -#endif - pmtranstype_t SYMEXPORT alpm_trans_get_type() { /* Sanity checks */ -- cgit v1.2.3-24-g4f1b