]> git.ipfire.org Git - thirdparty/git.git/blobdiff - credential-cache--daemon.c
test-path-utils: offer to run a protectNTFS/protectHFS benchmark
[thirdparty/git.git] / credential-cache--daemon.c
index 1e5f16a3a1272d4a87478525585951d76307750a..0d5c6250940633e75e2c9fb4b59b242a52188411 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "config.h"
 #include "tempfile.h"
 #include "credential.h"
 #include "unix-socket.h"
@@ -8,7 +9,7 @@ static struct tempfile socket_file;
 
 struct credential_cache_entry {
        struct credential item;
-       unsigned long expiration;
+       timestamp_t expiration;
 };
 static struct credential_cache_entry *entries;
 static int entries_nr;
@@ -47,12 +48,12 @@ static void remove_credential(const struct credential *c)
                e->expiration = 0;
 }
 
-static int check_expirations(void)
+static timestamp_t check_expirations(void)
 {
-       static unsigned long wait_for_entry_until;
+       static timestamp_t wait_for_entry_until;
        int i = 0;
-       unsigned long now = time(NULL);
-       unsigned long next = (unsigned long)-1;
+       timestamp_t now = time(NULL);
+       timestamp_t next = TIME_MAX;
 
        /*
         * Initially give the client 30 seconds to actually contact us
@@ -159,7 +160,7 @@ static void serve_one_client(FILE *in, FILE *out)
 static int serve_cache_loop(int fd)
 {
        struct pollfd pfd;
-       unsigned long wakeup;
+       timestamp_t wakeup;
 
        wakeup = check_expirations();
        if (!wakeup)
@@ -219,11 +220,11 @@ static void serve_cache(const char *socket_path, int debug)
        close(fd);
 }
 
-static const char permissions_advice[] =
+static const char permissions_advice[] = N_(
 "The permissions on your socket directory are too loose; other\n"
 "users may be able to read your cached credentials. Consider running:\n"
 "\n"
-"      chmod 0700 %s";
+"      chmod 0700 %s");
 static void init_socket_directory(const char *path)
 {
        struct stat st;
@@ -232,7 +233,7 @@ static void init_socket_directory(const char *path)
 
        if (!stat(dir, &st)) {
                if (st.st_mode & 077)
-                       die(permissions_advice, dir);
+                       die(_(permissions_advice), dir);
        } else {
                /*
                 * We must be sure to create the directory with the correct mode,