commit:     6aa65363c85d0a89c7b30cf304f999efe69edff0
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 29 15:43:06 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Nov 29 15:43:06 2025 +0000
URL:        https://gitweb.gentoo.org/proj/steve.git/commit/?id=6aa65363

Move fd_guard to util header

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 steve.cxx  | 7 ++-----
 stevie.cxx | 9 ++-------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/steve.cxx b/steve.cxx
index 41e5cfa..c567a13 100644
--- a/steve.cxx
+++ b/steve.cxx
@@ -34,6 +34,8 @@
 #include <fuse.h>
 #include <fuse_opt.h>
 
+#include "util.hxx"
+
 struct steve_read_waiter {
        fuse_req_t req;
        uint64_t pid;
@@ -448,11 +450,6 @@ static const struct option steve_long_opts[] = {
 
 static const char *steve_short_opts = "hVj:l:m:vd";
 
-struct fd_guard {
-       int fd;
-       ~fd_guard() { close(fd); }
-};
-
 int main(int argc, char **argv)
 {
        steve_state state{};

diff --git a/stevie.cxx b/stevie.cxx
index 59ccd41..523ed0c 100644
--- a/stevie.cxx
+++ b/stevie.cxx
@@ -16,6 +16,8 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
+#include "util.hxx"
+
 struct token_guard {
        int jobserver_fd;
        char job_token;
@@ -117,13 +119,6 @@ static int run_command(int jobserver_fd, char **argv, 
const char *jobserver_path
        return WIFSIGNALED(wret) ? WTERMSIG(wret) + 128 : WEXITSTATUS(wret);
 }
 
-struct fd_guard {
-       int fd;
-       ~fd_guard() {
-               close(fd);
-       }
-};
-
 static constexpr char stevie_usage[] =
        "usage: {} [options] <argv>...\n"
        "\n"

Reply via email to