URI: 
       tsafe-agent: code cleanup - safe - password protected secret keeper
  HTML git clone git://git.z3bra.org/safe.git
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 628d4291e5d7aff1034d71d33de9e877aaa56027
   DIR parent bda607548494962049a8b89cfd26b06304393807
  HTML Author: Willy Goiffon <dev@z3bra.org>
       Date:   Sun, 21 Aug 2022 17:09:18 +0200
       
       safe-agent: code cleanup
       
       Diffstat:
         M safe-agent.c                        |       8 ++------
       
       1 file changed, 2 insertions(+), 6 deletions(-)
       ---
   DIR diff --git a/safe-agent.c b/safe-agent.c
       t@@ -7,6 +7,7 @@
        #include <err.h>
        #include <fcntl.h>
        #include <limits.h>
       +#include <paths.h>
        #include <poll.h>
        #include <signal.h>
        #include <stdint.h>
       t@@ -24,9 +25,6 @@
                #include "strlcpy.h"
        #endif
        
       -#define SOCKDIR "/tmp/safe-XXXXXX"
       -#define SOCKET  "agent"
       -
        struct safe {
                int loaded;
                uint8_t saltkey[crypto_secretstream_xchacha20poly1305_KEYBYTES + crypto_pwhash_SALTBYTES];
       t@@ -292,8 +290,7 @@ main(int argc, char *argv[])
                if (setsid() < 0)
                        err(1, "setsid");
        
       -        chdir("/");
       -        if ((fd = open("/dev/null", O_RDWR, 0)) != -1) {
       +        if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
                        (void)dup2(fd, STDIN_FILENO);
                        (void)dup2(fd, STDOUT_FILENO);
                        (void)dup2(fd, STDERR_FILENO);
       t@@ -313,7 +310,6 @@ skip:
        
                if (verbose)
                        fprintf(stderr, "locking key in memory\n");
       -        sodium_mlock(s.saltkey, sizeof(s.saltkey));
        
                return servekey(timeout);
        }