From 138d4b3d84035f2e0547d7de999d7c7ebb6b7adc Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:52:55 +0000 Subject: Free space check, fixed parser jump bug, added importat Author: jgg Date: 1999-02-21 08:38:53 GMT Free space check, fixed parser jump bug, added importat --- cmdline/apt-get.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 451519c7c..da364e03c 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-get.cc,v 1.42 1999/02/15 08:23:10 jgg Exp $ +// $Id: apt-get.cc,v 1.43 1999/02/21 08:38:53 jgg Exp $ /* ###################################################################### apt-get - Cover for dpkg @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -534,7 +535,17 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true) c0out << DebBytes << ',' << Cache->DebSize() << endl; c0out << "How odd.. The sizes didn't match, email apt@packages.debian.org" << endl; } - + + // Check for enough free space + struct statfs Buf; + string OutputDir = _config->FindDir("Dir::Cache::Archives"); + if (statfs(OutputDir.c_str(),&Buf) != 0) + return _error->Errno("statfs","Couldn't determine free space in %s", + OutputDir.c_str()); + if (unsigned(Buf.f_bfree) < FetchBytes/Buf.f_bsize) + return _error->Error("Sorry, you don't have enough free space in %s", + OutputDir.c_str()); + // Number of bytes c1out << "Need to get "; if (DebBytes != FetchBytes) -- cgit v1.2.3