Do so centrally in the debug_set_output() function instead of on the call sites.
@@ -230,7 +230,6 @@ extern "C" {
fp = fopen(v, "a");
if (!fp)
ohshite(_("couldn't open debug file `%.255s'\n"), v);
- dpkg_set_report_buffer(fp);
debug_set_output(fp);
debug_set_mask(dbg_general | dbg_depcon);
@@ -25,6 +25,7 @@
#include <stdarg.h>
#include <stdio.h>
+#include <dpkg/report.h>
#include <dpkg/debug.h>
static int debug_mask = 0;
@@ -36,6 +37,7 @@ static FILE *debug_output = NULL;
void
debug_set_output(FILE *output)
{
+ dpkg_set_report_buffer(output);
debug_output = output;
}