{
static int count;
- if (count++ >= 100 && limit && file) {
- struct stat s;
- count = 0;
- if (fstat(fileno(file), &s) < 0) {
- VLOG_WARN("cannot fstat leak checker log file: %s",
- strerror(errno));
- return;
- }
- if (s.st_size > limit) {
- VLOG_WARN("leak checker log file size exceeded limit");
+ if (file) {
+ if (ferror(file)) {
+ VLOG_WARN("error writing leak checker log file");
leak_checker_stop();
return;
}
+
+ if (count++ >= 100 && limit) {
+ struct stat s;
+ count = 0;
+ if (fstat(fileno(file), &s) < 0) {
+ VLOG_WARN("cannot fstat leak checker log file: %s",
+ strerror(errno));
+ return;
+ }
+ if (s.st_size > limit) {
+ VLOG_WARN("leak checker log file size exceeded limit");
+ leak_checker_stop();
+ return;
+ }
+ }
}
if (file) {
set_hooks(&our_hooks);