Merge branch 'v0.21.x'
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user