summaryrefslogtreecommitdiffstats
path: root/src/fastd.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-01 16:26:39 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-01 16:26:39 +0200
commit8ccba8ebfaca85017eb125c45b0f16ae358358a7 (patch)
treec359b684bbc2ef0f0e60c190628fe4ab39599055 /src/fastd.c
parent8e589f3a3ad74dd4409632222c589aea7c0939a5 (diff)
downloadfastd-8ccba8ebfaca85017eb125c45b0f16ae358358a7.tar
fastd-8ccba8ebfaca85017eb125c45b0f16ae358358a7.zip
Remove support for log files
syslog/journald do a much better job at organizing logs, with the additional advantage of proper log rotation. If someone really wants to have a log file for fastd, they can just redirect stderr.
Diffstat (limited to 'src/fastd.c')
-rw-r--r--src/fastd.c42
1 files changed, 2 insertions, 40 deletions
diff --git a/src/fastd.c b/src/fastd.c
index 709f55f..2ca9dd4 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -120,49 +120,14 @@ static void init_signals(void) {
}
-static void init_log(void) {
- uid_t uid = geteuid();
- gid_t gid = getegid();
-
- if (conf.user || conf.group) {
- if (setegid(conf.gid) < 0)
- pr_debug_errno("setegid");
- if (seteuid(conf.uid) < 0)
- pr_debug_errno("seteuid");
- }
-
+static inline void init_log(void) {
if (conf.log_syslog_level > LL_UNSPEC)
openlog(conf.log_syslog_ident, LOG_PID, LOG_DAEMON);
- fastd_log_file_t *config;
- for (config = conf.log_files; config; config = config->next) {
- fastd_log_fd_t *file = malloc(sizeof(fastd_log_fd_t));
-
- file->config = config;
- file->fd = open(config->filename, O_WRONLY|O_APPEND|O_CREAT, 0600);
-
- file->next = ctx.log_files;
- ctx.log_files = file;
- }
-
ctx.log_initialized = true;
-
- if (seteuid(uid) < 0)
- pr_debug_errno("seteuid");
- if (setegid(gid) < 0)
- pr_debug_errno("setegid");
}
-static void close_log(void) {
- while (ctx.log_files) {
- fastd_log_fd_t *next = ctx.log_files->next;
-
- close(ctx.log_files->fd);
- free(ctx.log_files);
-
- ctx.log_files = next;
- }
-
+static inline void close_log(void) {
closelog();
}
@@ -684,9 +649,6 @@ int main(int argc, char *argv[]) {
pr_info("reconfigure triggered");
- close_log();
- init_log();
-
fastd_config_load_peer_dirs();
init_peers();
}