]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] fix several printf formats and missing arguments
authorWilly Tarreau <w@1wt.eu>
Fri, 3 Apr 2009 12:49:12 +0000 (14:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Apr 2009 12:49:12 +0000 (14:49 +0200)
Last patch revealed a number of mistakes in printf-like calls, mostly int/long
mismatches, and a few missing arguments.

src/cfgparse.c
src/checks.c
src/dumpstats.c
src/haproxy.c
src/log.c
src/memory.c
src/proto_http.c

index 3f86ce4def33633bd3c37f0c336216fd7a960263..8839e85ead515da8f2815ae92940ac06bb817927 100644 (file)
@@ -463,7 +463,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int inv)
        else if (!strcmp(args[0], "group")) {
                struct group *ha_group;
                if (global.gid != 0) {
-                       Alert("parsing [%s:%d] : gid/group was already specified. Continuing.\n", file, linenum, args[0]);
+                       Alert("parsing [%s:%d] : gid/group was already specified. Continuing.\n", file, linenum);
                        return 0;
                }
                errno = 0;
@@ -2938,7 +2938,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
                        return 0;
 
                if (*(args[2]) == 0) {
-                       Alert("parsing [%s:%d] : <%s> expects <status_code> and <url> as arguments.\n", file, linenum);
+                       Alert("parsing [%s:%d] : <%s> expects <status_code> and <url> as arguments.\n", file, linenum, args[0]);
                        return -1;
                }
 
@@ -2975,7 +2975,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
                        return 0;
 
                if (*(args[2]) == 0) {
-                       Alert("parsing [%s:%d] : <%s> expects <status_code> and <file> as arguments.\n", file, linenum);
+                       Alert("parsing [%s:%d] : <%s> expects <status_code> and <file> as arguments.\n", file, linenum, args[0]);
                        return -1;
                }
 
@@ -3506,8 +3506,8 @@ int readcfgfile(const char *file)
                newsrv = curproxy->srv;
                while (newsrv != NULL) {
                        if ((curproxy->mode != PR_MODE_HTTP) && (newsrv->rdr_len || newsrv->cklen)) {
-                               Alert("parsing %s, %s '%s' : server cannot have cookie or redirect prefix in non-HTTP mode.\n",
-                                     file, proxy_type_str(curproxy), curproxy->id, linenum);
+                               Alert("parsing [%s:%d] : %s '%s' : server cannot have cookie or redirect prefix in non-HTTP mode.\n",
+                                     file, linenum, proxy_type_str(curproxy), curproxy->id);
                                goto err;
                        }
                        newsrv = newsrv->next;
@@ -3530,8 +3530,8 @@ int readcfgfile(const char *file)
                                /* minconn was not specified, so we set it to maxconn */
                                newsrv->minconn = newsrv->maxconn;
                        } else if (newsrv->minconn != newsrv->maxconn && !curproxy->fullconn) {
-                               Alert("parsing %s, %s '%s' : fullconn is mandatory when minconn is set on a server.\n",
-                                     file, proxy_type_str(curproxy), curproxy->id, linenum);
+                               Alert("parsing [%s:%d] : %s '%s' : fullconn is mandatory when minconn is set on a server.\n",
+                                     file, linenum, proxy_type_str(curproxy), curproxy->id);
                                goto err;
                        }
 
index b48179afb95f262a776e93c2c21b54dc1cc183f5..216d2cba44f8c953a12653ff41f28ea4860d5f39 100644 (file)
@@ -221,7 +221,7 @@ static void set_server_up(struct server *s) {
                        " %d sessions requeued, %d total in queue.\n",
                        s->proxy->srv_act, s->proxy->srv_bck,
                        (s->proxy->srv_bck && !s->proxy->srv_act) ? " Running on backup." : "",
-                       s->cur_sess, xferred, s->nbpend);
+                       xferred, s->nbpend);
 
                Warning("%s", trash);
                send_log(s->proxy, LOG_NOTICE, "%s", trash);
index 34b808191b078967f253d146b0b643908499a5a6..a4e80c217346b902611056abc32a2cda33d6ce4c 100644 (file)
@@ -944,7 +944,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
                                        chunk_printf(&msg, sizeof(trash),
                                             "%d,%d,%d,%d,",
                                             sv->failed_checks, sv->down_trans,
-                                            now.tv_sec - sv->last_change, srv_downtime(sv));
+                                            (int)(now.tv_sec - sv->last_change), srv_downtime(sv));
                                else
                                        chunk_printf(&msg, sizeof(trash),
                                             ",,,,");
@@ -1084,7 +1084,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
                                     (px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : "DOWN",
                                     (px->lbprm.tot_weight * px->lbprm.wmult + px->lbprm.wdiv - 1) / px->lbprm.wdiv,
                                     px->srv_act, px->srv_bck,
-                                    px->down_trans, now.tv_sec - px->last_change,
+                                    px->down_trans, (int)(now.tv_sec - px->last_change),
                                     px->srv?be_downtime(px):0,
                                     relative_pid, px->uuid,
                                     px->cum_lbconn, STATS_TYPE_BE,
@@ -1437,7 +1437,7 @@ void stats_dump_errors_to_buffer(struct session *s, struct buffer *rep)
                        get_localtime(es->when.tv_sec, &tm);
                        chunk_printf(&msg, sizeof(trash), "\n[%02d/%s/%04d:%02d:%02d:%02d.%03d]",
                                     tm.tm_mday, monthname[tm.tm_mon], tm.tm_year+1900,
-                                    tm.tm_hour, tm.tm_min, tm.tm_sec, es->when.tv_usec/1000);
+                                    tm.tm_hour, tm.tm_min, tm.tm_sec, (int)(es->when.tv_usec/1000));
 
 
                        if (es->src.ss_family == AF_INET)
index 4a9795b357c7b3a4d896da358d606d49757bda34..e78c01d253f6adc8baf0184dfefbd007c5417d31 100644 (file)
@@ -1105,7 +1105,7 @@ int main(int argc, char **argv)
        getrlimit(RLIMIT_NOFILE, &limit);
        if (limit.rlim_cur < global.maxsock) {
                Warning("[%s.main()] FD limit (%d) too low for maxconn=%d/maxsock=%d. Please raise 'ulimit-n' to %d or more to avoid any trouble.\n",
-                       argv[0], limit.rlim_cur, global.maxconn, global.maxsock, global.maxsock);
+                       argv[0], (int)limit.rlim_cur, global.maxconn, global.maxsock, global.maxsock);
        }
 
        if (global.mode & MODE_DAEMON) {
index fc04232f8baf9cbc0e7a0479f0dc1b380e123de6..976bc63dfd31c9668123da0dbfaf21f27029ae5d 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -354,14 +354,14 @@ void tcp_sess_log(struct session *s)
        svid = (tolog & LW_SVID) ? (s->srv != NULL) ? s->srv->id : "<NOSRV>" : "-";
 
        send_log(prx_log, LOG_INFO, "%s:%d [%02d/%s/%04d:%02d:%02d:%02d.%03d]"
-                " %s %s/%s %d/%d/%s%d %s%lld"
-                " %c%c %d/%d/%d/%d/%s%u %d/%d\n",
+                " %s %s/%s %ld/%ld/%s%ld %s%lld"
+                " %c%c %d/%d/%d/%d/%s%u %ld/%ld\n",
                 pn,
                 (s->cli_addr.ss_family == AF_INET) ?
                 ntohs(((struct sockaddr_in *)&s->cli_addr)->sin_port) :
                 ntohs(((struct sockaddr_in6 *)&s->cli_addr)->sin6_port),
                 tm.tm_mday, monthname[tm.tm_mon], tm.tm_year+1900,
-                tm.tm_hour, tm.tm_min, tm.tm_sec, s->logs.tv_accept.tv_usec/1000,
+                tm.tm_hour, tm.tm_min, tm.tm_sec, (int)s->logs.tv_accept.tv_usec/1000,
                 fe->id, be->id, svid,
                 (s->logs.t_queue >= 0) ? s->logs.t_queue : -1,
                 (s->logs.t_connect >= 0) ? s->logs.t_connect - s->logs.t_queue : -1,
index 2fe37662d71cf702b2d5032f578ffca5627fa86e..05178e58ca11ea14a068f08dcf19fa76460420e7 100644 (file)
@@ -176,7 +176,7 @@ void dump_pools(void)
        allocated = used = nbpools = 0;
        qfprintf(stderr, "Dumping pools usage.\n");
        list_for_each_entry(entry, &pools, list) {
-               qfprintf(stderr, "  - Pool %s (%d bytes) : %d allocated (%lu bytes), %d used, %d users%s\n",
+               qfprintf(stderr, "  - Pool %s (%d bytes) : %d allocated (%u bytes), %d used, %d users%s\n",
                         entry->name, entry->size, entry->allocated,
                         entry->size * entry->allocated, entry->used,
                         entry->users, (entry->flags & MEM_F_SHARED) ? " [SHARED]" : "");
index 3325b31fc0349ae944f6d94eb2e6647db8c461d8..3dd11ec73860939b180f86311de9548bbb33bc5d 100644 (file)
@@ -831,14 +831,14 @@ void http_sess_log(struct session *s)
 
        send_log(prx_log, LOG_INFO,
                 "%s:%d [%02d/%s/%04d:%02d:%02d:%02d.%03d]"
-                " %s %s/%s %d/%d/%d/%d/%s%d %d %s%lld"
-                " %s %s %c%c%c%c %d/%d/%d/%d/%s%u %d/%d%s\n",
+                " %s %s/%s %d/%ld/%ld/%ld/%s%ld %d %s%lld"
+                " %s %s %c%c%c%c %d/%d/%d/%d/%s%u %ld/%ld%s\n",
                 pn,
                 (s->cli_addr.ss_family == AF_INET) ?
                 ntohs(((struct sockaddr_in *)&s->cli_addr)->sin_port) :
                 ntohs(((struct sockaddr_in6 *)&s->cli_addr)->sin6_port),
                 tm.tm_mday, monthname[tm.tm_mon], tm.tm_year+1900,
-                tm.tm_hour, tm.tm_min, tm.tm_sec, s->logs.accept_date.tv_usec/1000,
+                tm.tm_hour, tm.tm_min, tm.tm_sec, (int)s->logs.accept_date.tv_usec/1000,
                 fe->id, be->id, svid,
                 t_request,
                 (s->logs.t_queue >= 0) ? s->logs.t_queue - t_request : -1,