Commit a35e612c authored by Changli Gao's avatar Changli Gao

Don't call close(2) more than once

Don't call close(2) more then once, even though close(2) returns -1.

See the manual page for details.
parent 1b7d5414
...@@ -374,7 +374,7 @@ struct FileDescriptor { ...@@ -374,7 +374,7 @@ struct FileDescriptor {
explicit FileDescriptor(int fd) : fd_(fd) {} explicit FileDescriptor(int fd) : fd_(fd) {}
~FileDescriptor() { ~FileDescriptor() {
if (fd_ >= 0) { if (fd_ >= 0) {
NO_INTR(close(fd_)); close(fd_);
} }
} }
int get() { return fd_; } int get() { return fd_; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment