Browse Source

* logfile.c : don't use logger here

master
Alex 'AdUser' Z 8 years ago
parent
commit
85016b98ff
  1. 13
      src/logfile.c

13
src/logfile.c

@ -1,7 +1,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include "common.h" #include "common.h"
#include "log.h"
#include "logfile.h" #include "logfile.h"
bool bool
@ -13,23 +12,17 @@ f2b_logfile_open(f2b_logfile_t *file, const char *filename) {
memset(file, 0x0, sizeof(f2b_logfile_t)); memset(file, 0x0, sizeof(f2b_logfile_t));
if (stat(filename, &st) != 0) { if (stat(filename, &st) != 0)
log_msg(log_error, "can't open file %s: %s", filename, strerror(errno));
return false; return false;
}
strncpy(file->path, filename, sizeof(file->path)); strncpy(file->path, filename, sizeof(file->path));
memcpy(&file->st, &st, sizeof(st)); memcpy(&file->st, &st, sizeof(st));
if ((file->fd = fopen(filename, "r")) == NULL) { if ((file->fd = fopen(filename, "r")) == NULL)
log_msg(log_error, "can't open file %s: %s", filename, strerror(errno));
return false; return false;
}
if (fseek(file->fd, 0, SEEK_END) < 0) { if (fseek(file->fd, 0, SEEK_END) < 0)
log_msg(log_error, "can't seek to end of file %s: %s", filename, strerror(errno));
return false; return false;
}
return true; return true;
} }

Loading…
Cancel
Save