chiark / gitweb /
privcache: uncached_get: Introduce `defhash' local
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Dec 2019 14:01:57 +0000 (14:01 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Dec 2019 21:53:43 +0000 (21:53 +0000)
This is a bit more convenient and will also make a future commit much
easier too read.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
privcache.c

index 319732973624e5361a1fde039ec7be975e115d77..a5a67a520d36301bbc27d57485d14458de41987e 100644 (file)
@@ -46,6 +46,7 @@ static struct sigprivkey_if *uncached_get(struct privcache *st,
     sprintf(st->path.write_here, SIGKEYID_PR_FMT, SIGKEYID_PR_VAL(id));
 
     const char *path=st->path.buffer;
+    struct hash_if *defhash=st->defhash;
 
     f = fopen(path,"rb");
     if (!f) {
@@ -94,7 +95,7 @@ static struct sigprivkey_if *uncached_get(struct privcache *st,
     if (!ok) goto out; /* loadpriv will have logged */
 
     if (sigpriv->sethash) {
-       if (!st->defhash) {
+       if (!defhash) {
            slilog(log,M_ERR,
  "private key %s requires `hash' config key for privcache to load",
                   path);
@@ -102,7 +103,7 @@ static struct sigprivkey_if *uncached_get(struct privcache *st,
            sigpriv=0;
            goto out;
        }
-       sigpriv->sethash(sigpriv->st,st->defhash);
+       sigpriv->sethash(sigpriv->st,defhash);
     }
 
   out: