summaryrefslogtreecommitdiff
path: root/src/unique_fd.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/unique_fd.cc')
-rw-r--r--src/unique_fd.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/unique_fd.cc b/src/unique_fd.cc
new file mode 100644
index 0000000..eb2ed29
--- /dev/null
+++ b/src/unique_fd.cc
@@ -0,0 +1,10 @@
+#include "common.hh"
+
+#include "io.hh"
+#include "unique_fd.hh"
+
+void unique_fd::reset(int fd) {
+ if (fd_ >= 0)
+ io::close(fd_);
+ fd_ = fd;
+}