… | |
… | |
543 | { /* file missing? */ |
543 | { /* file missing? */ |
544 | sleep (1); |
544 | sleep (1); |
545 | if (e->fp) |
545 | if (e->fp) |
546 | fclose (e->fp); |
546 | fclose (e->fp); |
547 | if (openlog (e) == NULL) |
547 | if (openlog (e) == NULL) |
548 | break; |
548 | continue; |
549 | } |
549 | } |
550 | |
550 | |
|
|
551 | /* HACK this - stats can be uninitialised here (if the file |
|
|
552 | * didn't exist when stat() was called, but was recreated during |
|
|
553 | * the sleep(1)) */ |
551 | if (stats.st_ino != e->inode) |
554 | if (stats.st_ino != e->inode) |
552 | { /* file renamed? */ |
555 | { /* file renamed? */ |
553 | if (e->fp) |
556 | if (e->fp) |
554 | fclose (e->fp); |
557 | fclose (e->fp); |
555 | if (openlog (e) == NULL) |
558 | if (openlog (e) == NULL) |
556 | break; |
559 | continue; |
557 | } |
560 | } |
558 | |
561 | |
559 | if (stats.st_size < e->last_size) |
562 | if (stats.st_size < e->last_size) |
560 | { /* file truncated? */ |
563 | { /* file truncated? */ |
561 | fseek (e->fp, 0, SEEK_SET); |
564 | fseek (e->fp, 0, SEEK_SET); |
… | |
… | |
727 | |
730 | |
728 | /* if this is the same file we showed last, and the |
731 | /* if this is the same file we showed last, and the |
729 | * last time we showed it, it wasn't finished, then |
732 | * last time we showed it, it wasn't finished, then |
730 | * append to the last line shown */ |
733 | * append to the last line shown */ |
731 | if (lastprinted == current && current->lastpartial) |
734 | if (lastprinted == current && current->lastpartial) |
732 | { |
735 | append_line (listlen - 1, current->buf); |
|
|
736 | else if (current->lastpartial) |
|
|
737 | { |
|
|
738 | split_line (listlen - 1, continuation, current->color); |
733 | append_line (listlen - 1, current->buf); |
739 | append_line (listlen - 1, current->buf); |
734 | free (current->buf), current->buf = 0; |
740 | } |
735 | continue; |
|
|
736 | } |
|
|
737 | else |
741 | else |
738 | { |
|
|
739 | split_line (listlen - 1, current->buf, current->color); |
742 | split_line (listlen - 1, current->buf, current->color); |
|
|
743 | |
740 | free (current->buf), current->buf = 0; |
744 | free (current->buf), current->buf = 0; |
741 | } |
|
|
742 | |
|
|
743 | current->index = listlen - 1; |
745 | current->index = listlen - 1; |
744 | lastprinted = current; |
746 | lastprinted = current; |
745 | } |
747 | } |
746 | } |
748 | } |
747 | |
749 | |