|
|
@@ -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
|