summaryrefslogtreecommitdiff
path: root/src/unique_fd.cc
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-02-20 22:54:56 +0100
committerJoel Klinghed <the_jk@spawned.biz>2025-02-20 22:54:56 +0100
commitb4d6df902253637f24647d3db2bc3781d69eec1c (patch)
treed8bf9ac04a270fabdfee1c15628c702471ef8bf5 /src/unique_fd.cc
parent441cafc7124f633e5abc684e85a11ce3c991f6ae (diff)
Initial commitHEADmain
Diffstat (limited to 'src/unique_fd.cc')
-rw-r--r--src/unique_fd.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/unique_fd.cc b/src/unique_fd.cc
new file mode 100644
index 0000000..b864fb4
--- /dev/null
+++ b/src/unique_fd.cc
@@ -0,0 +1,9 @@
+#include "unique_fd.hh"
+
+#include <unistd.h>
+
+void unique_fd::reset(int fd) {
+ if (fd_ >= 0)
+ close(fd_);
+ fd_ = fd;
+}