Skip to content

Commit d81befc

Browse files
committed
samples: http_server: Fix warning about integer name
When building with CONFIG_DEBUG=y, there is a build warning about the name being truncated due to integer size is larger than MAX_NAME_LEN. So fix with modulo operator to be clear to the compiler what we expect. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
1 parent 31ef45e commit d81befc

File tree

1 file changed

+1
-1
lines changed
  • samples/net/sockets/http_server/src

1 file changed

+1
-1
lines changed

samples/net/sockets/http_server/src/ws.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ int ws_echo_setup(int ws_socket, struct http_request_ctx *request_ctx, void *use
324324
#define MAX_NAME_LEN sizeof("ws[xx]")
325325
char name[MAX_NAME_LEN];
326326

327-
snprintk(name, sizeof(name), "ws[%d]", slot);
327+
snprintk(name, sizeof(name), "ws[%d]", slot % (10 * MAX_NAME_LEN));
328328
k_thread_name_set(&ws_handler_thread[slot], name);
329329
}
330330

0 commit comments

Comments
 (0)