int r = fdi_push_log(best_fdi, logs, entry_out, filter);
if (r)
return r;
- if (*entry_out)
- return best_fdi->ops->has_log(best_fdi) ? 0 : BUFFER_NEWLY_DRAINED;
+ if (*entry_out) {
+ if (!is_limited_dumping(logs))
+ return best_fdi->ops->has_log(best_fdi) ? 0 : BUFFER_NEWLY_DRAINED;
+
+ free(*entry_out);
+ *entry_out = NULL;
+ }
} while (best_fdi->ops->has_log(best_fdi)); // if a buffer got drained, break to give them all a chance to refill
return BUFFER_NEWLY_DRAINED;
}
}
- if (*out) {
- if (!is_limited_dumping(&state->logs))
- return 0;
- free(*out);
- *out = NULL;
- }
+ if (*out)
+ return 0;
/* The oldest log can be so fresh as to be from the future
* (i.e. has a negative age). This can happen when somebody
}
}
- while (true) {
- int r = put_logs_into_vector(state->data_fds, state->fd_count, &state->logs, state->filter_object, out);
- if (r == 1)
- break;
- if (r < 0)
- return r;
- if (!*out)
- break;
-
- if (!is_limited_dumping(&state->logs))
- return 0;
- free(*out);
- *out = NULL;
- }
+ int r;
+ do
+ r = put_logs_into_vector(state->data_fds, state->fd_count, &state->logs, state->filter_object, out);
+ while (r == BUFFER_NEWLY_DRAINED && !*out);
+ if (r < 0)
+ return r;
+ if (*out)
+ return 0;
if (is_limited_dumping(&state->logs))
while (sort_vector_used_size(&state->logs) > state->logs.dump)