Skip to content

Commit b80a058

Browse files
jukkarkartben
authored andcommitted
samples: net: http_get: Fix format string issue
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 <[email protected]>
1 parent 2c3294b commit b80a058

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

samples/net/sockets/http_get/src/http_get.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#define HTTP_PATH "/"
4242

4343
#define SSTRLEN(s) (sizeof(s) - 1)
44-
#define CHECK(r) { if (r < 0) { printf("Error: %d\n", r); exit(1); } }
44+
#define CHECK(r) { if (r < 0) { printf("Error: %d\n", (int)r); exit(1); } }
4545

4646
#define REQUEST "GET " HTTP_PATH " HTTP/1.1\r\nHost: " HTTP_HOST "\r\n\r\n"
4747

0 commit comments

Comments
 (0)