Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: System freeze - scanning recordings ...



Thorsten Giese wrote:
> 
> Am Donnerstag, 18. September 2003 11:01 schrieben Sie:
> > Please insert a
> >
> >   print("%s\n", cmd);
> >
> > right after the asprintf() and then enter the command it prints
> > at a shell prompt. Do you get any error messages then?
> 
> Hello.
> 
> I inserted, as requested, the debug-line. The output was the following:
> 
> coruscant vdr-1.2.5 # ./vdr
> Entering cRecordings::Load
> find /video -follow -type d -name '*.rec' 2> /dev/null
> Got Filepointer
> in if
> 
> I then startes the line in a normal shell, with the same system environment
> variables:
> 
> coruscant vdr-1.2.5 # find /video -follow -type d -name '*.rec' 2> /dev/null
> /video/Doku:_Spurensuche_im_All/2003-09-18.11:29.50.50.rec
> 
> It exited without failure.

That's very odd. It would appear as if the find command didn't write
a terminating newline, so the fgets() in the readline() function waits
forever to get a complete line.

Please try changing the FINDCMD macro in recording.c to

#define FINDCMD      "find %s -follow -type d -name '%s' 2> /dev/null; echo"

The additional 'echo' should write a newline.

Klaus

> // --- cRecordings -----------------------------------------------------------
> 
> bool cRecordings::Load(bool Deleted)
> {
> fprintf(stderr, "Entering cRecordings::Load\n");
>   Clear();
>   bool result = false;
>   char *cmd = NULL;
>   asprintf(&cmd, FINDCMD, VideoDirectory, Deleted ? "*" DELEXT : "*" RECEXT);
> fprintf(stderr, "%s\n", cmd);
>   FILE *p = popen(cmd, "r");
> fprintf(stderr, "Got Filepointer\n");
>   if (p) {
> fprintf(stderr, "in if\n");
>      char *s;
>      while ((s = readline(p)) != NULL) {
> fprintf(stderr, "in while\n");
>            cRecording *r = new cRecording(s);
>            if (r->Name())
>               Add(r);
>            else
>               delete r;
>            }
>      pclose(p);
>      Sort();
>      result = Count() > 0;
>      }
>   else
>      Interface->Error("Error while opening pipe!");
>   free(cmd);
> fprintf(stderr, "before end\n");
>   return result;
> }


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index