Skip to content

Commit c46a38b

Browse files
committed
isapnp: Unbuffer stdout
1 parent 2af695b commit c46a38b

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

isapnp/isapnp.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ read_resource_data(uint8_t *byte)
137137

138138
/* Return failure if the read timed out. */
139139
if (i == 20) {
140-
printf("\n> Read timed out at byte %d", ftell(f) + buf_pos + 1);
140+
printf("\n> Read timed out at byte %d", ftell(f) + buf_pos + 1);
141141
*byte = 0x00;
142142
return 0;
143143
}
@@ -374,6 +374,9 @@ main(int argc, char **argv)
374374
int max_csn;
375375
card_t *card;
376376

377+
/* Disable stdout buffering. */
378+
term_unbuffer_stdout();
379+
377380
/* Try read data ports until a good one is found. iPXE tries
378381
[213:3FF] with a hole at [280:380] for whatever safety reason. */
379382
max_csn = -1;
@@ -386,18 +389,18 @@ main(int argc, char **argv)
386389
break;
387390
}
388391

389-
/* Nothing returned. */
390-
if (max_csn == -1) {
391-
printf("Found no cards and no good Read Data Ports!\n");
392-
return 1;
393-
}
394-
395392
/* Free the card list. */
396393
while (first_card) {
397394
card = first_card->next;
398395
free(first_card);
399396
first_card = card;
400397
}
401398

399+
/* Nothing returned. */
400+
if (max_csn < 0) {
401+
printf("Found no good Read Data Ports!\n");
402+
return 1;
403+
}
404+
402405
return 0;
403406
}

0 commit comments

Comments
 (0)