We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d3c3cca commit 465e325Copy full SHA for 465e325
tlc.c
@@ -221,6 +221,14 @@ proceed_input(FILE *f, long long *lineno) {
221
char *line = NULL, *out_str;
222
223
while ((linelen = getline(&line, &linesize, f)) != (size_t)-1) {
224
+ // fix non-blocking problems on non-OpenBSD (e.g., Linux)
225
+ if (ferror(f) && errno == EAGAIN) {
226
+ while (linelen--)
227
+ if (ungetc(line[linelen], f) == EOF)
228
+ err(1, "ungetc");
229
+ break;
230
+ }
231
+
232
(*lineno)++;
233
234
if (passthrough)
@@ -240,6 +248,11 @@ proceed_input(FILE *f, long long *lineno) {
240
248
free(out_str);
241
249
}
242
250
251
252
253
+ if (ferror(f) && errno == EAGAIN)
254
+ clearerr(f);
255
243
256
free(line);
244
257
245
258
0 commit comments