progs/pixie.c: Rename `log' function to `pxlog'.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 19 Jun 2013 00:39:03 +0000 (01:39 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 28 Jun 2013 23:30:17 +0000 (00:30 +0100)
Shuts up an annoying compiler warning.

progs/pixie.c

index 4a5e9ab..1198fcb 100644 (file)
@@ -86,7 +86,7 @@ static unsigned flags = 0;
 
 /*----- Event logging -----------------------------------------------------*/
 
-/* --- @log@ --- *
+/* --- @pxlog@ --- *
  *
  * Arguments:  @const char *p@ = @printf@-style format string
  *             @...@ = extra arguments to fill in
@@ -96,7 +96,7 @@ static unsigned flags = 0;
  * Use:                Writes out a timestamped log message.
  */
 
-static void log(const char *p, ...)
+static void pxlog(const char *p, ...)
 {
   dstr d = DSTR_INIT;
   va_list ap;
@@ -173,7 +173,7 @@ static void p_timer(struct timeval *tv, void *p)
 {
   phrase *pp = p;
   if (verbose)
-    log("expiring passphrase `%s'", pp->tag);
+    pxlog("expiring passphrase `%s'", pp->tag);
   p_free(pp);
 }
 
@@ -196,8 +196,8 @@ static void *p_alloc(size_t sz)
     if (P_ROOT->next == P_ROOT)
       return (0);
     if (verbose) {
-      log("flushing passphrase `%s' to free up needed space",
-         P_ROOT->next->tag);
+      pxlog("flushing passphrase `%s' to free up needed space",
+           p_head->tag);
     }
     p_free(P_ROOT->next);
   }
@@ -300,7 +300,7 @@ static void p_flush(const char *tag)
   phrase *p;
 
   if (!tag && verbose > 1)
-    log("flushing all passphrases");
+    pxlog("flushing all passphrases");
   p = P_ROOT->next;
   while (p != P_ROOT) {
     phrase *pp = p->next;
@@ -308,7 +308,7 @@ static void p_flush(const char *tag)
       p_free(p);
     else if (strcmp(p->tag, tag) == 0) {
       if (verbose > 1)
-       log("flushing passphrase `%s'", tag);
+       pxlog("flushing passphrase `%s'", tag);
       p_free(p);
       break;
     }
@@ -477,7 +477,7 @@ static int p_get(const char **q, const char *tag, unsigned mode, time_t exp)
   /* --- Write a log message --- */
 
   if (verbose > 1)
-    log("passphrase `%s' requested", tag);
+    pxlog("passphrase `%s' requested", tag);
 
   /* --- If there is no fetcher, life is simpler --- */
 
@@ -514,7 +514,7 @@ static int p_get(const char **q, const char *tag, unsigned mode, time_t exp)
       goto fail;
     if (strcmp(pp, p->p) != 0) {
       if (verbose)
-       log("passphrases for `%s' don't match", tag);
+       pxlog("passphrases for `%s' don't match", tag);
       p_free(p);
       goto fail;
     }
@@ -775,8 +775,8 @@ OK\n\
 
   else if (strcmp(q, "quit") == 0) {
     if (verbose)
-      log("%s client requested shutdown",
-         px->f & px_stdin ? "local" : "remote");
+      pxlog("%s client requested shutdown",
+           px->f & px_stdin ? "local" : "remote");
     pixserv_write(px, "OK\n");
     exit(0);
   }
@@ -837,7 +837,7 @@ static void pixserv_accept(int fd, unsigned mode, void *p)
   if ((nfd = accept(fd, (struct sockaddr *)&sun, &sunsz)) < 0) {
     if (verbose && errno != EAGAIN && errno != EWOULDBLOCK &&
        errno != ECONNABORTED && errno != EPROTO && errno != EINTR)
-      log("new connection failed: %s", strerror(errno));
+      pxlog("new connection failed: %s", strerror(errno));
     return;
   }
   pixserv_create(nfd, nfd);
@@ -886,7 +886,7 @@ static void pix_sigdie(int sig, void *p)
        p = buf;
        break;
     }
-    log("shutting down on %s", p);
+    pxlog("shutting down on %s", p);
   }
   exit(0);
 }
@@ -915,7 +915,7 @@ static void pix_sigflush(int sig, void *p)
        p = buf;
        break;
     }
-    log("received %s; flushing passphrases", p);
+    pxlog("received %s; flushing passphrases", p);
   }
   p_flush(0);
 }
@@ -984,12 +984,12 @@ static void pix_setup(struct sockaddr_un *sun, size_t sz)
        if (!S_ISSOCK(st.st_mode))
          die(1, "object `%s' isn't a socket", sun->sun_path);
        if (verbose)
-         log("stale socket found; removing it");
+         pxlog("stale socket found; removing it");
        unlink(sun->sun_path);
        close(fd);
       } else {
        if (verbose)
-         log("server already running; shutting it down");
+         pxlog("server already running; shutting it down");
        write(fd, "QUIT\n", 5);
        sleep(1);
        close(fd);
@@ -1376,8 +1376,8 @@ int main(int argc, char *argv[])
     if (rc < 0)
       die(EXIT_FAILURE, d.buf);
     else if (rc && verbose) {
-      log(d.buf);
-      log("couldn't lock passphrase buffer");
+      pxlog(d.buf);
+      pxlog("couldn't lock passphrase buffer");
     }
     dstr_destroy(&d);
     arena_setsecure(&lm.a);
@@ -1437,7 +1437,7 @@ int main(int argc, char *argv[])
   }
 
   if (verbose)
-    log("initialized ok");
+    pxlog("initialized ok");
 
   {
     int selerr = 0;
@@ -1445,10 +1445,10 @@ int main(int argc, char *argv[])
       if (!sel_select(&sel))
        selerr = 0;
       else if (errno != EINTR && errno != EAGAIN) {
-       log("error from select: %s", strerror(errno));
+       pxlog("error from select: %s", strerror(errno));
        selerr++;
        if (selerr > 8) {
-         log("too many consecutive select errors: bailing out");
+         pxlog("too many consecutive select errors: bailing out");
          exit(EXIT_FAILURE);
        }
       }