… | |
… | |
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) |
… | |
… | |
1146 | |
1145 | |
1147 | e->fname = xstrdup (fname); |
1146 | e->fname = xstrdup (fname); |
1148 | if (openlog (e) == NULL) |
1147 | if (openlog (e) == NULL) |
1149 | perror (fname), exit (1); |
1148 | perror (fname), exit (1); |
1150 | |
1149 | |
1151 | l = strlen (desc); |
1150 | e->desc = xstrdup (desc); |
1152 | /* HACK-6: width is in pixels now */ |
|
|
1153 | if (l > width - 2) /* must account for [ ] */ |
|
|
1154 | l = width - 2; |
|
|
1155 | e->desc = xmalloc (l + 1); |
|
|
1156 | memcpy (e->desc, desc, l); |
|
|
1157 | *(e->desc + l) = '\0'; |
|
|
1158 | } |
1151 | } |
1159 | |
1152 | |
1160 | e->color = GetColor (fcolor); |
1153 | e->color = GetColor (fcolor); |
1161 | e->partial = 0; |
1154 | e->partial = 0; |
1162 | e->next = NULL; |
1155 | e->next = NULL; |