Skip to content

Commit 0550432

Browse files
committed
Fixed regression from commit 1e116d0 preventing stdin data piping.
1 parent 399837d commit 0550432

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/parser.c

+9-7
Original file line numberDiff line numberDiff line change
@@ -2051,13 +2051,10 @@ static int
20512051
read_lines (FILE *fp, GLog *glog, int dry_run) {
20522052
int b, k, cnt = 0, test = conf.num_tests > 0 ? 1 : 0;
20532053
void *status;
2054+
char *s = NULL;
20542055
GJob jobs[2][conf.jobs];
20552056
pthread_t threads[conf.jobs];
20562057

2057-
#ifndef WITH_GETLINE
2058-
char *s = NULL;
2059-
#endif
2060-
20612058
glog->bytes = 0;
20622059

20632060
for (b = 0; b < 2; b++) {
@@ -2078,10 +2075,11 @@ read_lines (FILE *fp, GLog *glog, int dry_run) {
20782075
}
20792076

20802077
b = 0;
2081-
while (!feof (fp)) { // b = 0 or 1
2078+
while (1) { /* b = 0 or 1 */
20822079
for (k = 1; k < conf.jobs || (conf.jobs == 1 && k == 1); k++) {
20832080
#ifdef WITH_GETLINE
2084-
while ((jobs[b][k].lines[jobs[b][k].p] = fgetline (fp)) != NULL) {
2081+
while ((s = fgetline (fp)) != NULL) {
2082+
jobs[b][k].lines[jobs[b][k].p] = s;
20852083
#else
20862084
while ((s = fgets (jobs[b][k].lines[jobs[b][k].p], LINE_BUFFER, fp)) != NULL) {
20872085
#endif
@@ -2132,10 +2130,14 @@ read_lines (FILE *fp, GLog *glog, int dry_run) {
21322130
if (conf.stop_processing)
21332131
break;
21342132

2133+
/* check for EOF */
2134+
if (s == NULL)
2135+
break;
2136+
21352137
/* flip from block A/B to B/A */
21362138
if (conf.jobs > 1)
21372139
b = b ^ 1;
2138-
} // while (!eof)
2140+
} // while (1)
21392141

21402142
/* After eof, process last data */
21412143
for (b = 0; b < 2; b++) {

0 commit comments

Comments
 (0)