Hi again, I have implemented the patches. I have also patched the logger for ability to log into file as I didn't manage to redirect output using start-stop-deamon.. I will let you know when the logs would say something interresting. Last time it took about 4 months till it stopped working… :) -- Ondrej Florian Lohoff napsal(a):
Thanks - took a while to get the code into my brain again - This solves an accidental zero pmt pid in the PAT - i'd like to make shure we are not just papering over a different bug ...
Is the PAT broken? Do we overrun the PAT section under certain conditions while parsing?
If you had time i'd like to see the output of this debug patch - it'll debug the whole psi sections in case we stumple on a zero pmt pid (this is just compile tested)
Flo
--- getstream-old/getstream.c 2009-08-01 12:01:35.000000000 +0200 +++ getstream/getstream.c 2010-01-17 11:19:21.000000000 +0100 @@ -98,7 +98,7 @@ static void usage(void ) { - fprintf(stderr, "-c <config file> -d -t <timeout>\n"); + fprintf(stderr, "-c <config file> -d -t <timeout> -l <logfile>\n"); exit(-1); } @@ -110,8 +110,10 @@ int timeout=0; GList *al; struct config_s *config=NULL; + + logwrite_init(); - while((ch=getopt(argc, argv, "c:dt:")) != -1) { + while((ch=getopt(argc, argv, "c:dt:l:")) != -1) { switch(ch) { case 'c': config=readconfig(optarg); @@ -124,6 +126,10 @@ case 't': timeout=strtol(optarg, NULL, 10); break; + case 'l': + if (logwrite_set_output(optarg) == 0) + exit(1); + break; default: usage(); break; diff -u getstream-old/getstream.h getstream/getstream.h --- getstream-old/getstream.h 2009-08-01 12:01:35.000000000 +0200 +++ getstream/getstream.h 2010-01-17 11:19:37.000000000 +0100 @@ -403,8 +403,10 @@ * * */ +void logwrite_init(); void logwrite_inc_level(void ); void logwrite(int level, const char *format, ...); +int logwrite_set_output(const char * file); enum { LOG_ERROR, --- getstream-old/logging.c 2009-08-01 12:01:35.000000000 +0200 +++ getstream/logging.c 2010-01-17 11:23:11.000000000 +0100 @@ -1,12 +1,20 @@ #include <stdio.h> #include <stdarg.h> #include <stdlib.h> +#include <string.h> +#include <errno.h> #include <sys/param.h> #include <time.h> #include "getstream.h" int loglevel=LOG_ERROR; +static FILE * logfile; + +void logwrite_init() { + if (!logfile) + logfile = stdout; +} void logwrite_inc_level() { loglevel++; @@ -32,8 +40,20 @@ strftime(timedate, sizeof(timedate), "%Y-%m-%d %H:%M:%S", tm); - printf("%s.%03d %s\n", + fprintf(logfile, "%s.%03d %s\n", timedate, (int) tv.tv_usec/1000, logbuffer); + + fflush(logfile); } + +int logwrite_set_output(const char * file) { + logfile = fopen(file, "a"); + if (logfile == NULL) { + fprintf(stderr, "Log file open failed: %s\n", strerror(errno)); + return 0; + } + return 1; +} +