]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
spawn: improve the pipe log reading
authorJaroslav Kysela <perex@perex.cz>
Mon, 17 Nov 2014 16:13:16 +0000 (17:13 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 17 Nov 2014 16:13:16 +0000 (17:13 +0100)
src/spawn.c

index 0d9e9c628080f2dd41920064ccc6d872a64261fc..a21528ccdea6329165562747639dce5b82d8b7ce 100644 (file)
@@ -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) {