Brian Silverman | 58899fd | 2019-03-24 11:03:11 -0700 | [diff] [blame] | 1 | #include "aos/scoped/scoped_fd.h" |
| 2 | |
Stephan Pleines | d07111d | 2024-05-30 11:06:05 -0700 | [diff] [blame] | 3 | #include <unistd.h> |
| 4 | |
| 5 | #include <ostream> |
| 6 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 7 | #include "glog/logging.h" |
Brian Silverman | 58899fd | 2019-03-24 11:03:11 -0700 | [diff] [blame] | 8 | |
| 9 | namespace aos { |
| 10 | |
| 11 | void ScopedFD::Close() { |
| 12 | if (fd_ != -1) { |
| 13 | if (close(fd_) == -1) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 14 | PLOG(WARNING) << "close(" << fd_ << ") failed"; |
Brian Silverman | 58899fd | 2019-03-24 11:03:11 -0700 | [diff] [blame] | 15 | } |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | } // namespace aos |