From: Richard Jones Date: Tue, 14 Apr 2009 13:38:31 +0000 (+0100) Subject: Better handling of trailing \n problem. X-Git-Tag: 0.9.1~2 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=374af1d1c85580a7768967bf2f199f10182b011e;p=libguestfs.git Better handling of trailing \n problem. --- 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. */ }