Warn about broken pipes in filters instead of exiting abruptly

This commit is contained in:
Eric Fischer
2016-12-21 10:10:22 -08:00
parent 6a5461763c
commit 71ac6596af
3 changed files with 24 additions and 7 deletions
+10 -2
View File
@@ -1378,8 +1378,16 @@ void *run_prefilter(void *v) {
}
if (fclose(rpa->prefilter_fp) != 0) {
perror("fclose output to prefilter");
exit(EXIT_FAILURE);
if (errno == EPIPE) {
static bool warned = false;
if (!warned) {
fprintf(stderr, "Warning: broken pipe in prefilter\n");
warned = true;
}
} else {
perror("fclose output to prefilter");
exit(EXIT_FAILURE);
}
}
return NULL;
}