blob: 4e9054d620f3c3d2b61627fe7445024c1ead2ecc [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
Austin Schuh99f7c6a2024-06-25 22:07:44 -07007#include "absl/log/check.h"
8#include "absl/log/log.h"
Brian Silverman58899fd2019-03-24 11:03:11 -07009
10namespace aos {
11
12void ScopedFD::Close() {
13 if (fd_ != -1) {
14 if (close(fd_) == -1) {
Alex Perrycb7da4b2019-08-28 19:35:56 -070015 PLOG(WARNING) << "close(" << fd_ << ") failed";
Brian Silverman58899fd2019-03-24 11:03:11 -070016 }
17 }
18}
19
20} // namespace aos