… | |
… | |
658 | if (stat (e->fname, &stats) < 0) |
658 | if (stat (e->fname, &stats) < 0) |
659 | { /* file missing? */ |
659 | { /* file missing? */ |
660 | sleep (1); |
660 | sleep (1); |
661 | if (e->fp) |
661 | if (e->fp) |
662 | fclose (e->fp); |
662 | fclose (e->fp); |
663 | openlog (e); |
663 | if (openlog (e) == NULL) |
664 | continue; |
664 | continue; |
|
|
665 | if (fstat (fileno (e->fp), &stats) < 0) |
|
|
666 | continue; |
665 | } |
667 | } |
666 | |
668 | |
667 | /* HACK-3: stats can be uninitialised here (if the file didn't |
|
|
668 | * exist when stat() was called, but was recreated during the |
|
|
669 | * sleep(1)) */ |
|
|
670 | if (stats.st_ino != e->inode) |
669 | if (stats.st_ino != e->inode) |
671 | { /* file renamed? */ |
670 | { /* file renamed? */ |
672 | if (e->fp) |
671 | if (e->fp) |
673 | fclose (e->fp); |
672 | fclose (e->fp); |
674 | if (openlog (e) == NULL) |
673 | if (openlog (e) == NULL) |