From b80a058e9043087f2a114310df48eab4638598b6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 28 Jan 2025 12:35:43 +0200 Subject: [PATCH] samples: net: http_get: Fix format string issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This issue is seen by at least gcc 11.4.0 samples/net/sockets/http_get/src/http_get.c:44:40: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=] 44 | #define CHECK(r) { if (r < 0) { | printf("Error: %d\n", r); exit(1); } } | ^~~~~~~~~~~~~ samples/net/sockets/http_get/src/http_get.c:44:49: note: format string is defined here 44 | #define CHECK(r) { if (r < 0) { printf("Error: %d\n", r); exit(1); } } | ~^ | | | int | %ld Signed-off-by: Jukka Rissanen --- samples/net/sockets/http_get/src/http_get.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/net/sockets/http_get/src/http_get.c b/samples/net/sockets/http_get/src/http_get.c index ecb228bc7902..81b268fe533a 100644 --- a/samples/net/sockets/http_get/src/http_get.c +++ b/samples/net/sockets/http_get/src/http_get.c @@ -41,7 +41,7 @@ #define HTTP_PATH "/" #define SSTRLEN(s) (sizeof(s) - 1) -#define CHECK(r) { if (r < 0) { printf("Error: %d\n", r); exit(1); } } +#define CHECK(r) { if (r < 0) { printf("Error: %d\n", (int)r); exit(1); } } #define REQUEST "GET " HTTP_PATH " HTTP/1.1\r\nHost: " HTTP_HOST "\r\n\r\n"