summaryrefslogtreecommitdiff
path: root/src/unique_fd.cc
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2021-11-17 22:34:57 +0100
committerJoel Klinghed <the_jk@spawned.biz>2021-11-17 22:34:57 +0100
commit6232d13f5321b87ddf12a1aa36b4545da45f173d (patch)
tree23f3316470a14136debd9d02f9e920ca2b06f4cc /src/unique_fd.cc
Travel3: Simple image and video display site
Reads the images and videos from filesystem and builds a site in memroy.
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;
+}