From: Michael Tremer Date: Wed, 29 Jan 2025 16:47:46 +0000 (+0000) Subject: log file: Reset the file handle immediately X-Git-Tag: 0.9.30~296 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=46cd2253b6ea6f22c327d920cf839f95badd1ee2;p=pakfire.git log file: Reset the file handle immediately Since we are calling some logging functions from here we might want to write to the closed file handle. Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/log_file.c b/src/pakfire/log_file.c index 12ea180b..50fadfe9 100644 --- a/src/pakfire/log_file.c +++ b/src/pakfire/log_file.c @@ -128,14 +128,14 @@ int pakfire_log_file_close(struct pakfire_log_file* self) { if (self->f) { r = fclose(self->f); + self->f = NULL; + if (r < 0) { ERROR(self->ctx, "Could not close log file: %s\n", strerror(-r)); return r; } DEBUG(self->ctx, "Closed log file %s\n", self->path); - - self->f = NULL; } return 0;