blob: f2375abf7b2fea2b764094574dc166e891be19b8 [file] [log] [blame]
Brian Silverman58899fd2019-03-24 11:03:11 -07001#include "aos/scoped/scoped_fd.h"
2
Stephan Pleinesd07111d2024-05-30 11:06:05 -07003#include <unistd.h>
4
5#include <ostream>
6
Alex Perrycb7da4b2019-08-28 19:35:56 -07007#include "glog/logging.h"
Brian Silverman58899fd2019-03-24 11:03:11 -07008
9namespace aos {
10
11void ScopedFD::Close() {
12 if (fd_ != -1) {
13 if (close(fd_) == -1) {
Alex Perrycb7da4b2019-08-28 19:35:56 -070014 PLOG(WARNING) << "close(" << fd_ << ") failed";
Brian Silverman58899fd2019-03-24 11:03:11 -070015 }
16 }
17}
18
19} // namespace aos