From 44098f9b18d03906efe255884d3321755cab164d Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Sun, 3 May 2026 17:18:23 +0200 Subject: [PATCH] fix again --- src/fm95.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/fm95.c b/src/fm95.c index fe3383a..43f9d84 100644 --- a/src/fm95.c +++ b/src/fm95.c @@ -458,6 +458,9 @@ void init_runtime(FM95_Runtime* runtime, const FM95_Config config) { } #define BUF_SIZE 256 +#define PREFIX "ECHO: " +#define PREFIX_LEN 6 + static void *handle_client(void *arg) { int fd = *(int *)arg; free(arg); @@ -469,8 +472,8 @@ static void *handle_client(void *arg) { buf[n] = '\0'; printf("[client fd=%d] %s\n", fd, buf); - char reply[BUF_SIZE]; - snprintf(reply, sizeof(reply), "ECHO: %s", buf); + char reply[BUF_SIZE + PREFIX_LEN]; + snprintf(reply, sizeof(reply), PREFIX "%s", buf); send(fd, reply, strlen(reply), 0); }