skip if file size is changing
This commit is contained in:
parent
792ac397f4
commit
2ffb32bcb4
33
file.c
33
file.c
|
@ -23,7 +23,27 @@ struct epg *
|
|||
open_file(char *filename)
|
||||
{
|
||||
struct epg *epg;
|
||||
struct stat st;
|
||||
struct stat st, st2;
|
||||
|
||||
if (debug)
|
||||
printf("Opening file '%s'\n", filename);
|
||||
|
||||
if (stat(filename, &st) == -1)
|
||||
{
|
||||
perror(filename);
|
||||
return NULL;
|
||||
}
|
||||
sleep(1);
|
||||
if (stat(filename, &st2) == -1)
|
||||
{
|
||||
perror(filename);
|
||||
return NULL;
|
||||
}
|
||||
if (st.st_size != st2.st_size)
|
||||
{
|
||||
printf("EPG data file is updating, try later.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(epg = malloc(sizeof(struct epg))))
|
||||
{
|
||||
|
@ -31,18 +51,7 @@ open_file(char *filename)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
printf("Opening file '%s'\n", filename);
|
||||
|
||||
strcpy(epg->fname, filename);
|
||||
|
||||
if (stat(epg->fname, &st) == -1)
|
||||
{
|
||||
perror(epg->fname);
|
||||
free(epg);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
epg->binsize = st.st_size;
|
||||
|
||||
if (debug)
|
||||
|
|
Loading…
Reference in New Issue