Description: Fix a whole slew of warnings from the C compiler.
Forwarded: no
Author: Peter Pentchev <roam@ringlet.net>
Last-Update: 2010-10-12

--- lib/config.c
+++ lib/config.c
@@ -1034,19 +1034,19 @@
    bufused = snprintfn(buf, sizeof(buf), "extension(s): ");
    if (state->extension.bind)
       bufused += snprintfn(&buf[bufused], sizeof(buf) - bufused, "bind");
-   slog(LOG_DEBUG, buf);
+   slog(LOG_DEBUG, "%s", buf);
 
    bufused = snprintfn(buf, sizeof(buf), "protocol(s): ");
    protocols2string(&state->protocol,
    &buf[bufused], sizeof(buf) - bufused);
-   slog(LOG_DEBUG, buf);
+   slog(LOG_DEBUG, "%s", buf);
 
    showmethod(state->methodc, state->methodv);
 
    bufused = snprintfn(buf, sizeof(buf), "proxyprotocol(s): ");
    proxyprotocols2string(&state->proxyprotocol,
    &buf[bufused], sizeof(buf) - bufused);
-   slog(LOG_DEBUG, buf);
+   slog(LOG_DEBUG, "%s", buf);
 
 #if HAVE_GSSAPI
    if (methodisset(AUTHMETHOD_GSSAPI, state->methodv, state->methodc)) {
--- lib/httpproxy.c
+++ lib/httpproxy.c
@@ -59,7 +59,7 @@
    struct sockaddr addr;
    socklen_t addrlen;
 
-   slog(LOG_DEBUG, function);
+   slog(LOG_DEBUG, "%s", function);
 
    sockshost2string(&packet->req.host, host, sizeof(host));
 
--- lib/msproxy_clientprotocol.c
+++ lib/msproxy_clientprotocol.c
@@ -300,7 +300,7 @@
    struct sockaddr_in addr;
    socklen_t len;
 
-   slog(LOG_DEBUG, function);
+   slog(LOG_DEBUG, "%s", function);
 
 #if 0
 
@@ -521,7 +521,7 @@
    struct sockaddr_in addr;
    socklen_t len;
 
-   slog(LOG_DEBUG, function);
+   slog(LOG_DEBUG, "%s", function);
 
    bzero(&req, sizeof(req));
    req.clientid = packet->state.msproxy.clientid;
@@ -685,7 +685,7 @@
    struct timeval timeout;
    int dbits;
 
-   slog(LOG_DEBUG, function);
+   slog(LOG_DEBUG, "%s", function);
 
    /*
     * Find the socket we were signalled for.
@@ -1888,7 +1888,7 @@
    struct socksfd_t socksfdmem;
    int i, max;
 
-   slog(LOG_DEBUG, function);
+   slog(LOG_DEBUG, "%s", function);
 
    for (i = 0, max = getmaxofiles(softlimit); i < max; ++i) {
       if ((socksfd = socks_getaddr(i, 1)) == NULL)
@@ -1911,7 +1911,7 @@
    const char *function = "msproxy_sessionend()";
    struct msproxy_request_t req;
 
-   slog(LOG_DEBUG, function);
+   slog(LOG_DEBUG, "%s", function);
 
    bzero(&req, sizeof(req));
    *req.username   = NUL;
@@ -1937,7 +1937,7 @@
    struct msproxy_response_t res;
    int i, max;
 
-   slog(LOG_DEBUG, function);
+   slog(LOG_DEBUG, "%s", function);
 
    for (i = 0, max = getmaxofiles(softlimit); i < max; ++i) {
       if ((socksfd = socks_getaddr(i, 1)) == NULL)
--- sockd/serverconfig.c
+++ sockd/serverconfig.c
@@ -596,13 +596,13 @@
    for (i = 0; (size_t)i < sockscf->methodc; ++i)
       bufused += snprintfn(&buf[bufused], sizeof(buf) - bufused, "%s%s",
       i > 0 ? ", " : "", method2string(sockscf->methodv[i]));
-   slog(LOG_DEBUG, buf);
+   slog(LOG_DEBUG, "%s", buf);
 
    bufused = snprintfn(buf, sizeof(buf), "clientmethod(s): ");
    for (i = 0; (size_t)i < sockscf->clientmethodc; ++i)
       bufused += snprintfn(&buf[bufused], sizeof(buf) - bufused, "%s%s",
       i > 0 ? ", " : "", method2string(sockscf->clientmethodv[i]));
-   slog(LOG_DEBUG, buf);
+   slog(LOG_DEBUG, "%s", buf);
 
    if (sockscf->option.debug) {
       struct rule_t *rule;
--- sockd/sockd.c
+++ sockd/sockd.c
@@ -472,7 +472,7 @@
                                   "%lu slot%s free",
                                   function, childtype2string(child->type),
                                   (unsigned long)child->pid,
-                                  child->freec, child->freec == 1 ? "" : "s");
+                                  (unsigned long)child->freec, child->freec == 1 ? "" : "s");
 
                   if (child->type == CHILD_IO) {
                      /*
@@ -1071,7 +1071,7 @@
 
    sig = -sig;
 
-   slog(LOG_DEBUG, function);
+   slog(LOG_DEBUG, "%s", function);
 
    clients = 0;
    clients += childcheck(-CHILD_NEGOTIATE);
@@ -1190,7 +1190,7 @@
 
    sig = -sig;
 
-   slog(LOG_DEBUG, function);
+   slog(LOG_DEBUG, "%s", function);
 
    while (1) {
       pid = waitpid(WAIT_ANY, &status, WNOHANG);
--- lib/config_parse.c
+++ lib/config_parse.c
@@ -1334,8 +1334,8 @@
    va_end(ap);
 
    if (errno)
-      serr(EXIT_FAILURE, buf);
-   serrx(EXIT_FAILURE, buf);
+      serr(EXIT_FAILURE, "%s", buf);
+   serrx(EXIT_FAILURE, "%s", buf);
 }
 
 void
@@ -1364,8 +1364,8 @@
    va_end(ap);
 
    if (errno)
-      swarn(buf);
-   swarnx(buf);
+      swarn("%s", buf);
+   swarnx("%s", buf);
 }
 
 static void
--- lib/config_scan.c
+++ lib/config_scan.c
@@ -2020,7 +2020,7 @@
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#define ECHO if (fwrite( yytext, yyleng, 1, yyout ) != 1) yy_fatal_error("flex: config_scan.c: fwrite() failed")
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
--- lib/upnp.c
+++ lib/upnp.c
@@ -79,7 +79,7 @@
    int devtype, rc;
 #endif /* HAVE_LIBMINIUPNP */
 
-   slog(LOG_DEBUG, function);
+   slog(LOG_DEBUG, "%s", function);
 
 #if !HAVE_LIBMINIUPNP
    return -1;
@@ -210,7 +210,7 @@
    int rc;
 #endif /* HAVE_LIBMINIUPNP */
 
-   slog(LOG_DEBUG, function);
+   slog(LOG_DEBUG, "%s", function);
 
 #if !HAVE_LIBMINIUPNP
    SERRX(0);
--- sockd/auth_pam.c
+++ sockd/auth_pam.c
@@ -174,7 +174,7 @@
    }
 
    if ((rc = pam_end(pamh, rc)) != PAM_SUCCESS)
-      swarnx("%s: strange ... pam_end() failed: %s", pam_strerror(pamh, rc));
+      swarnx("%s: strange ... pam_end() failed: %s", function, pam_strerror(pamh, rc));
 
    return 0;
 }
--- sockd/sockd_child.c
+++ sockd/sockd_child.c
@@ -573,8 +573,8 @@
 
    if (type >= 0) {
        if (proxyc < minfreeslots && sockscf.child.addchild) {
-         slog(LOG_DEBUG, "%s: current # of free %s-slots is %d, thus less than "
-                         "configured minimum of %d.  Trying to add a "
+         slog(LOG_DEBUG, "%s: current # of free %s-slots is %lu, thus less than "
+                         "configured minimum of %lu.  Trying to add a "
                          "%s-child",
                          function, childtype2string(type),
                          (unsigned long)proxyc, (unsigned long)minfreeslots,
