Browse Source

* logfile.[ch]: add state flag to f2b_logfile_t struct

master
Alex 'AdUser' Z 9 years ago
parent
commit
48c4af7f89
  1. 2
      src/logfile.c
  2. 1
      src/logfile.h

2
src/logfile.c

@ -33,6 +33,7 @@ f2b_logfile_open(f2b_logfile_t *file, const char *path) {
memcpy(&file->st, &st, sizeof(st)); memcpy(&file->st, &st, sizeof(st));
strlcpy(file->path, buf, sizeof(file->path)); strlcpy(file->path, buf, sizeof(file->path));
file->opened = true;
return true; return true;
} }
@ -41,6 +42,7 @@ void
f2b_logfile_close(const f2b_logfile_t *file) { f2b_logfile_close(const f2b_logfile_t *file) {
assert(file != NULL); assert(file != NULL);
fclose(file->fd); fclose(file->fd);
file->opened = false;
} }
bool bool

1
src/logfile.h

@ -9,6 +9,7 @@
typedef struct f2b_logfile_t { typedef struct f2b_logfile_t {
struct f2b_logfile_t *next; struct f2b_logfile_t *next;
bool opened;
char path[PATH_MAX]; char path[PATH_MAX];
FILE *fd; FILE *fd;
struct stat st; struct stat st;

Loading…
Cancel
Save