Instead of doing excessive flushes when using isc_stdio API, disable the
buffered IO for the FILE * pointer completely and disable the guts of
the isc_stdio_flush() function as there are no buffered data now.
if (f == NULL) {
return isc__errno2result(errno);
}
+
+ int r = setvbuf(f, NULL, _IONBF, 0);
+ if (r != 0) {
+ fclose(f);
+ return isc__errno2result(errno);
+ }
+
*fp = f;
return ISC_R_SUCCESS;
}
}
isc_result_t
-isc_stdio_flush(FILE *f) {
- int r;
-
- r = fflush(f);
- if (r == 0) {
- return ISC_R_SUCCESS;
- } else {
- return isc__errno2result(errno);
- }
+isc_stdio_flush(FILE *f ISC_ATTR_UNUSED) {
+ /* We disable buffering when opening the file */
+ return ISC_R_SUCCESS;
}
isc_result_t