From 48c4af7f89de9f1fa731c2032dfc5cd67076252c Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Wed, 23 Mar 2016 21:29:36 +1000 Subject: [PATCH] * logfile.[ch]: add state flag to f2b_logfile_t struct --- src/logfile.c | 2 ++ src/logfile.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/logfile.c b/src/logfile.c index d30cfe7..794979d 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -33,6 +33,7 @@ f2b_logfile_open(f2b_logfile_t *file, const char *path) { memcpy(&file->st, &st, sizeof(st)); strlcpy(file->path, buf, sizeof(file->path)); + file->opened = true; return true; } @@ -41,6 +42,7 @@ void f2b_logfile_close(const f2b_logfile_t *file) { assert(file != NULL); fclose(file->fd); + file->opened = false; } bool diff --git a/src/logfile.h b/src/logfile.h index a520926..38443df 100644 --- a/src/logfile.h +++ b/src/logfile.h @@ -9,6 +9,7 @@ typedef struct f2b_logfile_t { struct f2b_logfile_t *next; + bool opened; char path[PATH_MAX]; FILE *fd; struct stat st;