From 374af1d1c85580a7768967bf2f199f10182b011e Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Tue, 14 Apr 2009 14:38:31 +0100 Subject: [PATCH] Better handling of trailing \n problem. --- daemon/command.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/daemon/command.c b/daemon/command.c index 589ca76..03537f0 100644 --- a/daemon/command.c +++ b/daemon/command.c @@ -79,10 +79,10 @@ do_command_lines (char * const * const argv) if (pend) { *pend = '\0'; pend++; - } - /* Final \n? Don't return an empty final element. */ - if (pend && *pend == '\0') break; + /* Final \n? Don't return an empty final element. */ + if (*pend == '\0') break; + } if (add_string (&lines, &size, &alloc, p) == -1) { free (out); @@ -97,5 +97,5 @@ do_command_lines (char * const * const argv) if (add_string (&lines, &size, &alloc, NULL) == -1) return NULL; - return lines; + return lines; /* Caller frees. */ } -- 1.8.3.1