summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-02-13 14:29:20 +0100
committerMichael Vogt <mvo@debian.org>2014-02-13 14:29:20 +0100
commit784e35e86293094bb5c1456c8f9c844df2a71f12 (patch)
tree28073f068ca09c46c04a5ed9e047824f782b15ac /apt-pkg/contrib/fileutl.cc
parenta84a4d2ab78c498d9797c07d463daec4095b37de (diff)
parent28b4b983d95fa742a5431547285a748e8b856399 (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: configure.ac debian/changelog
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r--apt-pkg/contrib/fileutl.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 37155b688..71ac9c73f 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1594,11 +1594,17 @@ unsigned long long FileFd::Tell()
unsigned long long FileFd::FileSize()
{
struct stat Buf;
- if ((d == NULL || d->pipe == false) && fstat(iFd,&Buf) != 0)
- return FileFdErrno("fstat","Unable to determine the file size");
+
+ bool ispipe = (d != NULL && d->pipe == true);
+ if (ispipe == false)
+ {
+ if (fstat(iFd,&Buf) != 0)
+ return FileFdErrno("fstat","Unable to determine the file size");
+ ispipe = S_ISFIFO(Buf.st_mode);
+ }
// for compressor pipes st_size is undefined and at 'best' zero
- if ((d != NULL && d->pipe == true) || S_ISFIFO(Buf.st_mode))
+ if (ispipe == true)
{
// we set it here, too, as we get the info here for free
// in theory the Open-methods should take care of it already