From 57a37f8af46b54a018a2007b3afceadcf2bf2020 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Fri, 10 Apr 2020 16:41:36 +0200 Subject: [PATCH 1/2] run_command: Update outdated docstring --- src/ipc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ipc.c b/src/ipc.c index 100e1f70..368bea52 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -217,8 +217,7 @@ void ipc_shutdown(shutdown_reason_t reason, int exempt_fd) { } /* - * Executes the command and returns whether it could be successfully parsed - * or not (at the moment, always returns true). + * Executes the given command. * */ IPC_HANDLER(run_command) { From 964456b628523c9e8d5cb182d11837ad51b0dae9 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Fri, 10 Apr 2020 16:41:51 +0200 Subject: [PATCH 2/2] Limit log length with IPC commands Fixes #3525 --- src/commands.c | 2 +- src/commands_parser.c | 2 +- src/ipc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands.c b/src/commands.c index 14bd877d..ddc659eb 100644 --- a/src/commands.c +++ b/src/commands.c @@ -766,7 +766,7 @@ void cmd_border(I3_CMD, const char *border_style_str, long border_width) { */ void cmd_nop(I3_CMD, const char *comment) { LOG("-------------------------------------------------\n"); - LOG(" NOP: %s\n", comment); + LOG(" NOP: %.4000s\n", comment); LOG("-------------------------------------------------\n"); ysuccess(true); } diff --git a/src/commands_parser.c b/src/commands_parser.c index f734a7aa..2fd76309 100644 --- a/src/commands_parser.c +++ b/src/commands_parser.c @@ -263,7 +263,7 @@ char *parse_string(const char **walk, bool as_word) { * Free the returned CommandResult with command_result_free(). */ CommandResult *parse_command(const char *input, yajl_gen gen, ipc_client *client) { - DLOG("COMMAND: *%s*\n", input); + DLOG("COMMAND: *%.4000s*\n", input); state = INITIAL; CommandResult *result = scalloc(1, sizeof(CommandResult)); diff --git a/src/ipc.c b/src/ipc.c index 368bea52..75fa8ee7 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -224,7 +224,7 @@ IPC_HANDLER(run_command) { /* To get a properly terminated buffer, we copy * message_size bytes out of the buffer */ char *command = sstrndup((const char *)message, message_size); - LOG("IPC: received: *%s*\n", command); + LOG("IPC: received: *%.4000s*\n", command); yajl_gen gen = yajl_gen_alloc(NULL); CommandResult *result = parse_command(command, gen, client);