diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-10-07 09:12:22 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-10-07 09:13:15 +0200 |
| commit | c87f9627efc8b612eb9b000acfcc6731cad15765 (patch) | |
| tree | 34eb4b9e70a51c2f3db3a97c2aef31ba0b139ec9 /src/unique_fd.cc | |
Initial commit
Diffstat (limited to 'src/unique_fd.cc')
| -rw-r--r-- | src/unique_fd.cc | 9 |
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..135a449 --- /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_ != -1) + close(fd_); + fd_ = fd; +} |
