]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
xmltv: catch errors form spawn_and_store_stdout
authorNiels Ole Salscheider <niels_ole@salscheider-online.de>
Sat, 11 Aug 2012 16:58:23 +0000 (18:58 +0200)
committerAdam Sutton <dev@adamsutton.me.uk>
Sat, 11 Aug 2012 20:18:56 +0000 (21:18 +0100)
src/epggrab/module/xmltv.c

index 375e54b2fd80619ab2397b07d0d9cac6872f1875..699e4d4bf3e4873f55a805e5930a93e9119e5e76 100644 (file)
@@ -525,7 +525,8 @@ static int _xmltv_parse
 
 static void _xmltv_load_grabbers ( void )
 {
-  size_t i, outlen, p, n;
+  int outlen;
+  size_t i, p, n;
   char *outbuf;
   char name[1000];
   char *tmp, *path;
@@ -534,7 +535,7 @@ static void _xmltv_load_grabbers ( void )
   outlen = spawn_and_store_stdout(XMLTV_FIND, NULL, &outbuf);
 
   /* Process */
-  if ( outlen ) {
+  if ( outlen > 0 ) {
     p = n = i = 0;
     while ( i < outlen ) {
       if ( outbuf[i] == '\n' || outbuf[i] == '\0' ) {
@@ -574,7 +575,7 @@ static void _xmltv_load_grabbers ( void )
           if (lstat(bin, &st)) continue;
           if (!(st.st_mode & S_IEXEC)) continue;
           if (!S_ISREG(st.st_mode)) continue;
-          if ((outlen = spawn_and_store_stdout(bin, argv, &outbuf))) {
+          if ((outlen = spawn_and_store_stdout(bin, argv, &outbuf)) > 0) {
             if (outbuf[outlen-1] == '\n') outbuf[outlen-1] = '\0';
             snprintf(name, sizeof(name), "XMLTV: %s", outbuf);
             epggrab_module_int_create(NULL, bin, name, 3, bin,