diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2009-10-20 08:30:21 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2009-10-20 08:30:21 +0200 |
commit | c1ce032acd71b8414ee8d9a1f20899f8e53388a0 (patch) | |
tree | 87a4160fc6cb5bb1d02706243e379fad2361f405 /cmdline | |
parent | 0883532c8b3a2464498c33dbcff21bc13692cddc (diff) |
only warn if (free) space can't be determined as it overflows the struct
as this prevents e.g. download operations on large RAIDs (Closes: #522238)
Diffstat (limited to 'cmdline')
-rw-r--r-- | cmdline/apt-get.cc | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index ca14f4c2b..49fde7466 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -862,10 +862,14 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, { struct statvfs Buf; string OutputDir = _config->FindDir("Dir::Cache::Archives"); - if (statvfs(OutputDir.c_str(),&Buf) != 0) - return _error->Errno("statvfs",_("Couldn't determine free space in %s"), - OutputDir.c_str()); - if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize) + if (statvfs(OutputDir.c_str(),&Buf) != 0) { + if (errno == EOVERFLOW) + return _error->WarningE("statvfs",_("Couldn't determine free space in %s"), + OutputDir.c_str()); + else + return _error->Errno("statvfs",_("Couldn't determine free space in %s"), + OutputDir.c_str()); + } else if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize) { struct statfs Stat; if (statfs(OutputDir.c_str(),&Stat) != 0 @@ -2228,10 +2232,14 @@ bool DoSource(CommandLine &CmdL) // Check for enough free space struct statvfs Buf; string OutputDir = "."; - if (statvfs(OutputDir.c_str(),&Buf) != 0) - return _error->Errno("statvfs",_("Couldn't determine free space in %s"), - OutputDir.c_str()); - if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize) + if (statvfs(OutputDir.c_str(),&Buf) != 0) { + if (errno == EOVERFLOW) + return _error->WarningE("statvfs",_("Couldn't determine free space in %s"), + OutputDir.c_str()); + else + return _error->Errno("statvfs",_("Couldn't determine free space in %s"), + OutputDir.c_str()); + } else if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize) { struct statfs Stat; if (statfs(OutputDir.c_str(),&Stat) != 0 |