From: Willy Tarreau Date: Thu, 24 Nov 2022 14:32:20 +0000 (+0100) Subject: CLEANUP: peers: fix format string for status messages (int signedness) X-Git-Tag: v2.7-dev10~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d05aa38950e106202b8bd374d73329d2c3e3a4ac;p=thirdparty%2Fhaproxy.git CLEANUP: peers: fix format string for status messages (int signedness) In issue #1939, Ilya mentions that cppchecks warned about use of "%d" to report the status state that's locally stored as an unsigned int. While technically valid, this will never cause any trouble since in the end what we store there are the applet's states (just a few enum values). Better use %u anyway to silence this warning. --- diff --git a/src/peers.c b/src/peers.c index 95b4b9f161..fcfa05d71a 100644 --- a/src/peers.c +++ b/src/peers.c @@ -616,7 +616,7 @@ static int peer_prepare_status_errormsg(char *msg, size_t size, struct peer_prep unsigned int st1; st1 = p->error_status.st1; - ret = snprintf(msg, size, "%d\n", st1); + ret = snprintf(msg, size, "%u\n", st1); if (ret >= size) return 0;