Mailing List archive

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

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



On Mon, 22 Sep 2003, Thorsten Giese wrote:

>#define FINDCMD "/usr/bin/find %s -follow -type d -name '%s' 2>
>/dev/null;echo"
>#define MAXPARSEBUFFER KILOBYTE(10)
>
>char *readline(FILE *f)
>{
>  static char buffer[MAXPARSEBUFFER];
>  if (fgets(buffer, sizeof(buffer), f) > 0) {
>     int l = strlen(buffer) - 1;
>     if (l >= 0 && buffer[l] == '\n')
>        buffer[l] = 0;
>     return buffer;
>     }
>  return NULL;
>}
>
>
>int main(){
>
>        char *cmd = NULL;
>        asprintf(&cmd, FINDCMD, "/video", "*.rec");
>        FILE *p = popen(cmd, "r");
>
>        char *s;
>        while ((s = readline(p)) != NULL) {
>           sprintf(stderr, "%s", *s);
>        }
>        pclose(p);
>
>
>//      system(cmd);
>        return 0;
>}
>
>
>coruscant root # gcc -I /usr/include/ bla.c
>bla.c: In function `readline':
>bla.c:10: error: storage size of `buffer' isn't constant
>bla.c:10: error: size of variable `buffer' is too large

Just hardcode the buffer to something, such as:

#define MAXPARSEBUFFER 1000

or

static char buffer[1000];


>bla.c: In function `main':
>bla.c:29: warning: passing arg 1 of `sprintf' from incompatible pointer type

It's just a warning...

-- 
"It would seem that you have no useful skill or talent whatsoever," he said.
              "Have you thought of going into teaching?"
                                                    -- Terry Pratchett, Mort


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



Home | Main Index | Thread Index