summaryrefslogtreecommitdiff
path: root/src/core/log.c
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2017-11-26 00:31:01 +0100
committerGitHub <noreply@github.com>2017-11-26 00:31:01 +0100
commit466d074200e4893f57c4c716c746e8549af65339 (patch)
treedce2b3013e63b295c14af90d62f9acbd908c2ac7 /src/core/log.c
parent8dfeca57ede1e726de07522a87203ce13676882d (diff)
parent3792bc9ba95b8b9fd12ad60b86b8bbb06e913dc1 (diff)
downloadirssi-466d074200e4893f57c4c716c746e8549af65339.zip
Merge branch 'master' into hide-lines
Diffstat (limited to 'src/core/log.c')
-rw-r--r--src/core/log.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/log.c b/src/core/log.c
index cee1dab5..f7741d3d 100644
--- a/src/core/log.c
+++ b/src/core/log.c
@@ -26,6 +26,9 @@
#include "servers.h"
#include "log.h"
#include "write-buffer.h"
+#ifdef HAVE_CAPSICUM
+#include "capsicum.h"
+#endif
#include "lib-config/iconfig.h"
#include "settings.h"
@@ -114,13 +117,23 @@ int log_start_logging(LOG_REC *log)
/* path may contain variables (%time, $vars),
make sure the directory is created */
dir = g_path_get_dirname(log->real_fname);
+#ifdef HAVE_CAPSICUM
+ capsicum_mkdir_with_parents_wrapper(dir, log_dir_create_mode);
+#else
g_mkdir_with_parents(dir, log_dir_create_mode);
+#endif
g_free(dir);
}
+#ifdef HAVE_CAPSICUM
+ log->handle = log->real_fname == NULL ? -1 :
+ capsicum_open_wrapper(log->real_fname, O_WRONLY | O_APPEND | O_CREAT,
+ log_file_create_mode);
+#else
log->handle = log->real_fname == NULL ? -1 :
open(log->real_fname, O_WRONLY | O_APPEND | O_CREAT,
log_file_create_mode);
+#endif
if (log->handle == -1) {
signal_emit("log create failed", 1, log);
log->failed = TRUE;