Merge branch 'v0.21.x'

This commit is contained in:
Max Kellermann
2020-07-01 16:56:17 +02:00
6 changed files with 38 additions and 5 deletions

View File

@@ -25,6 +25,8 @@
#include "io/FileDescriptor.hxx"
#include "util/RuntimeError.hxx"
#include <cinttypes> // for PRIu64 (PRIoffset)
#include <sys/stat.h>
#include <fcntl.h>
@@ -97,6 +99,11 @@ FileInputStream::Read(std::unique_lock<Mutex> &,
nbytes = reader.Read(ptr, read_size);
}
if (nbytes == 0 && !IsEOF())
throw FormatRuntimeError("Unexpected end of file %s"
" at %" PRIoffset " of %" PRIoffset,
GetURI(), GetOffset(), GetSize());
offset += nbytes;
return nbytes;
}