From 873727125564c9d984221cd24658764095486545 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Tue, 26 Dec 2023 12:13:09 +0100 Subject: [PATCH 1/3] core/logging: fixup -Wformat-signedness warnings --- core/logging.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/logging.c b/core/logging.c index ac2f37a49..e7ab9f930 100644 --- a/core/logging.c +++ b/core/logging.c @@ -720,7 +720,7 @@ void uwsgi_logit_simple(struct wsgi_request *wsgi_req) { } if (uwsgi.logging_options.memory_report) { - rlen = snprintf(mempkt, 4096, "{address space usage: %lld bytes/%lluMB} {rss usage: %llu bytes/%lluMB} ", + rlen = snprintf(mempkt, 4096, "{address space usage: %llu bytes/%lluMB} {rss usage: %llu bytes/%lluMB} ", (unsigned long long) uwsgi.workers[uwsgi.mywid].vsz_size, (unsigned long long) uwsgi.workers[uwsgi.mywid].vsz_size / 1024 / 1024, (unsigned long long) uwsgi.workers[uwsgi.mywid].rss_size, @@ -772,7 +772,7 @@ void get_memusage(uint64_t * rss, uint64_t * vsz) { int i; procfile = fopen("/proc/self/stat", "r"); if (procfile) { - i = fscanf(procfile, "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %llu %lld", (unsigned long long *) vsz, (unsigned long long *) rss); + i = fscanf(procfile, "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %llu %llu", (unsigned long long *) vsz, (unsigned long long *) rss); if (i != 2) { uwsgi_log("warning: invalid record in /proc/self/stat\n"); } else { @@ -786,7 +786,7 @@ void get_memusage(uint64_t * rss, uint64_t * vsz) { int i; procfile = fopen("/proc/self/stat", "r"); if (procfile) { - i = fscanf(procfile, "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %llu %lld", (unsigned long long *) vsz, (unsigned long long *) rss); + i = fscanf(procfile, "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %llu %llu", (unsigned long long *) vsz, (unsigned long long *) rss); if (i != 2) { uwsgi_log("warning: invalid record in /proc/self/stat\n"); } From eb47ac2c9608e149d242aabf5b8bc812d787cade Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Tue, 26 Dec 2023 13:44:34 +0100 Subject: [PATCH 2/3] core/utils: use unsigned values in uwsgi_uuid --- core/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/utils.c b/core/utils.c index c198bb44a..420a34397 100644 --- a/core/utils.c +++ b/core/utils.c @@ -4097,7 +4097,7 @@ void uwsgi_uuid(char *buf) { uuid_generate(uuid_value); uuid_unparse(uuid_value, buf); #else - int i, r[11]; + unsigned int i, r[11]; if (!uwsgi_file_exists("/dev/urandom")) goto fallback; int fd = open("/dev/urandom", O_RDONLY); @@ -4113,7 +4113,7 @@ void uwsgi_uuid(char *buf) { goto done; fallback: for (i = 0; i < 11; i++) { - r[i] = rand(); + r[i] = (unsigned int) rand(); } done: snprintf(buf, 37, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10]); From a6f841f2a9d58c2b3a3928f3f03d343c1ae2e996 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Thu, 28 Dec 2023 11:53:45 +0100 Subject: [PATCH 3/3] uwsgiconfig: add -Wformat-signedness --- uwsgiconfig.py | 1 + 1 file changed, 1 insertion(+) diff --git a/uwsgiconfig.py b/uwsgiconfig.py index 26a5297a5..8fe31ccb1 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -684,6 +684,7 @@ def __init__(self, filename, mute=False): '-I.', '-Wall', '-Werror', + '-Wformat-signedness', '-Wno-error=deprecated-declarations', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64'