Skip to content

Commit ed7600b

Browse files
committed
fixed the error when loading directory
1 parent cb76f56 commit ed7600b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/filesystem.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ class PosixReadableFile : public ReadableFile {
3737
: new std::ifstream(WPATH(filename),
3838
is_binary ? std::ios::binary | std::ios::in
3939
: std::ios::in)) {
40-
if (!*is_)
40+
if (!*is_ || (is_->peek() && is_->fail())) {
4141
status_ = util::StatusBuilder(util::StatusCode::kNotFound, GTL_LOC)
4242
<< "\"" << filename.data() << "\": " << util::StrError(errno);
43+
}
4344
}
4445

4546
~PosixReadableFile() {

0 commit comments

Comments
 (0)