summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2013-10-11 13:07:01 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2013-11-30 12:38:26 +0100
commitad5051ef9da4e1f384237ecf1260e0cad95e0ea7 (patch)
tree8d77bcf0da5d81b66ebd7f34c633dac9298683e1 /apt-pkg
parent80cc2c3723a1e28f45edd78168c72a26d41403e9 (diff)
downloadapt-ad5051ef9da4e1f384237ecf1260e0cad95e0ea7.tar.gz
truncating /dev/null to zero is always successful
Calling truncate on /dev/null can happen by the download methods if they are instructed to download a file to /dev/null (as testcases are only interested in the status code, but do not support HEAD requests yet) So just ignore truncate calls on the /dev/null file as it is always empty anyway, so truncating to zero isn't a problem. Git-Dch: Ignore
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/fileutl.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 3a6bdfe2..7fbe4d60 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1545,6 +1545,9 @@ bool FileFd::Skip(unsigned long long Over)
/* */
bool FileFd::Truncate(unsigned long long To)
{
+ // truncating /dev/null is always successful - as we get an error otherwise
+ if (To == 0 && FileName == "/dev/null")
+ return true;
#if defined HAVE_ZLIB || defined HAVE_BZ2
if (d != NULL && (d->gz != NULL || d->bz2 != NULL))
return FileFdError("Truncating compressed files is not implemented (%s)", FileName.c_str());