Check whether the file descriptor is valid
calling PosixWritableFile::Close twice should not cause segfaults
This commit is contained in:
parent
9dba78a2fa
commit
693aa38472
@ -105,6 +105,9 @@ class PosixWritableFile : public WritableFile {
|
||||
}
|
||||
|
||||
Status Close() override {
|
||||
if (file_ == nullptr) {
|
||||
return IOError(filename_, EBADF);
|
||||
}
|
||||
Status result;
|
||||
if (fclose(file_) != 0) {
|
||||
result = IOError(filename_, errno);
|
||||
|
Loading…
Reference in New Issue
Block a user