mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-07-31 08:49:17 +02:00
fix again
This commit is contained in:
+5
-2
@@ -458,6 +458,9 @@ void init_runtime(FM95_Runtime* runtime, const FM95_Config config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define BUF_SIZE 256
|
#define BUF_SIZE 256
|
||||||
|
#define PREFIX "ECHO: "
|
||||||
|
#define PREFIX_LEN 6
|
||||||
|
|
||||||
static void *handle_client(void *arg) {
|
static void *handle_client(void *arg) {
|
||||||
int fd = *(int *)arg;
|
int fd = *(int *)arg;
|
||||||
free(arg);
|
free(arg);
|
||||||
@@ -469,8 +472,8 @@ static void *handle_client(void *arg) {
|
|||||||
buf[n] = '\0';
|
buf[n] = '\0';
|
||||||
printf("[client fd=%d] %s\n", fd, buf);
|
printf("[client fd=%d] %s\n", fd, buf);
|
||||||
|
|
||||||
char reply[BUF_SIZE];
|
char reply[BUF_SIZE + PREFIX_LEN];
|
||||||
snprintf(reply, sizeof(reply), "ECHO: %s", buf);
|
snprintf(reply, sizeof(reply), PREFIX "%s", buf);
|
||||||
send(fd, reply, strlen(reply), 0);
|
send(fd, reply, strlen(reply), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user