summaryrefslogtreecommitdiffstats
path: root/src/log.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-12-16 16:48:58 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-12-16 16:48:58 +0100
commit7f7041b1ff851bed8932fecb8d2a4a991d177721 (patch)
tree1de2227f8502436aaa2de0217e91155f7d66e30f /src/log.c
parent8e9c9bc6ec2877f73e0ecdfd25fbf96464f08885 (diff)
downloadfastd-7f7041b1ff851bed8932fecb8d2a4a991d177721.tar
fastd-7f7041b1ff851bed8932fecb8d2a4a991d177721.zip
Never write to syslog/log files during key generation
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/log.c b/src/log.c
index 78978f2..81dfb20 100644
--- a/src/log.c
+++ b/src/log.c
@@ -234,7 +234,7 @@ void fastd_logf(const fastd_context_t *ctx, fastd_loglevel_t level, const char *
buffer[sizeof(buffer)-1] = 0;
- if (ctx->conf == NULL || level <= ctx->conf->log_stderr_level || ctx->conf->log_files) {
+ if (!ctx->log_initialized || level <= ctx->conf->log_stderr_level || ctx->conf->log_files) {
time_t t;
struct tm tm;
@@ -245,15 +245,17 @@ void fastd_logf(const fastd_context_t *ctx, fastd_loglevel_t level, const char *
}
}
- if (ctx->conf == NULL || level <= ctx->conf->log_stderr_level)
+ if (!ctx->log_initialized || level <= ctx->conf->log_stderr_level)
fprintf(stderr, "%s%s%s\n", timestr, get_log_prefix(level), buffer);
- if (ctx->conf != NULL && level <= ctx->conf->log_syslog_level)
- syslog(get_syslog_level(level), "%s", buffer);
+ if (ctx->log_initialized) {
+ if (level <= ctx->conf->log_syslog_level)
+ syslog(get_syslog_level(level), "%s", buffer);
- fastd_log_fd_t *file;
- for (file = ctx->log_files; file; file = file->next) {
- if (level <= file->config->level)
- dprintf(file->fd, "%s%s%s\n", timestr, get_log_prefix(level), buffer);
+ fastd_log_fd_t *file;
+ for (file = ctx->log_files; file; file = file->next) {
+ if (level <= file->config->level)
+ dprintf(file->fd, "%s%s%s\n", timestr, get_log_prefix(level), buffer);
+ }
}
}