From: Vladimír Čunát Date: Wed, 16 Sep 2020 11:10:44 +0000 (+0200) Subject: daemon/io_tty_process_input: remove a special case X-Git-Tag: v5.2.0~28^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=789441f22d9ad03d5752d28c24c7521e6475c1d4;p=thirdparty%2Fknot-resolver.git daemon/io_tty_process_input: remove a special case After changes in this MR, sending an empty newline evaluates in lua as nil, and that seems fine. Let's drop this piece of code; it was broken now anyway (incorrect `io_mode_text` part). --- diff --git a/daemon/io.c b/daemon/io.c index 4fb10c1b7..1e5513471 100644 --- a/daemon/io.c +++ b/daemon/io.c @@ -501,18 +501,6 @@ void io_tty_process_input(uv_stream_t *stream, ssize_t nread, const uv_buf_t *bu } commands[nread] = '\0'; - const char *delim = args->quiet ? "" : "> "; - - /* No command, just new line */ - if (nread == 1 && (data->mode == io_mode_text) == false && commands[nread-1] == '\0' && data->blen == 0) { - if (stream_fd != STDIN_FILENO) { - fprintf(out, "%s", delim); - } - if (stream_fd == STDIN_FILENO || VERBOSE_STATUS) { - fprintf(stdout, "%s", delim); - } - } - char *boundary = "\n\0"; cmd = strtok(commands, "\n"); /* strtok skip '\n' but we need process alone '\n' too */ @@ -576,7 +564,9 @@ void io_tty_process_input(uv_stream_t *stream, ssize_t nread, const uv_buf_t *bu fwrite(message, len_s, 1, out); goto next_iter; } + /* Log to remote socket if connected */ + const char *delim = args->quiet ? "" : "> "; if (stream_fd != STDIN_FILENO) { if (VERBOSE_STATUS) fprintf(stdout, "%s\n", cmd); /* Duplicate command to logs */