From: Jaroslav Kysela Date: Mon, 17 Nov 2014 16:13:16 +0000 (+0100) Subject: spawn: improve the pipe log reading X-Git-Tag: v4.1~750 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cee7147eefac38a16ae6f1cdbe78952eec7eebf7;p=thirdparty%2Ftvheadend.git spawn: improve the pipe log reading --- diff --git a/src/spawn.c b/src/spawn.c index 0d9e9c628..a21528ccd 100644 --- a/src/spawn.c +++ b/src/spawn.c @@ -90,9 +90,15 @@ spawn_pipe_read( th_pipe_t *p, char **_buf, int level ) } buf[len + r] = '\0'; tvhlog_hexdump("spawn", buf + len, r); - while ((s = strchr(buf, '\n')) != NULL) { + while (1) { + s = buf; + while (*s && *s != '\n' && *s != '\r') + s++; + if (*s == '\0') + break; *s++ = '\0'; - tvhlog(level, "spawn", "%s", buf); + if (buf[0]) + tvhlog(level, "spawn", "%s", buf); memmove(buf, s, strlen(s) + 1); } if (strlen(buf) == SPAWN_PIPE_READ_SIZE - 1) {