summaryrefslogtreecommitdiff
path: root/src/core/log.c
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2017-07-28 05:08:34 +0100
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2017-07-29 23:52:23 +0100
commit241dd66ac11d54b37c671cd56f1320fe5b83803d (patch)
tree6dbb0b59d1553329048935b37dfafc709751e161 /src/core/log.c
parent939371aa1dfdbf11fe98648e1eafc4c95e80bb9e (diff)
downloadirssi-241dd66ac11d54b37c671cd56f1320fe5b83803d.zip
Working /log and /rawlog.
Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
Diffstat (limited to 'src/core/log.c')
-rw-r--r--src/core/log.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/core/log.c b/src/core/log.c
index cee1dab5..00686bee 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"
@@ -73,6 +76,16 @@ static void log_write_timestamp(int handle, const char *format,
if (text != NULL) write_buffer(handle, text, strlen(text));
}
+static int log_open_wrapper(const char *path, int flags, int mode)
+{
+#ifdef HAVE_CAPSICUM
+ if (capsicum_enabled())
+ return capsicum_open(path, flags, mode);
+#endif
+
+ return open(path, flags, mode);
+}
+
static char *log_filename(LOG_REC *log)
{
char *str, fname[1024];
@@ -119,7 +132,7 @@ int log_start_logging(LOG_REC *log)
}
log->handle = log->real_fname == NULL ? -1 :
- open(log->real_fname, O_WRONLY | O_APPEND | O_CREAT,
+ log_open_wrapper(log->real_fname, O_WRONLY | O_APPEND | O_CREAT,
log_file_create_mode);
if (log->handle == -1) {
signal_emit("log create failed", 1, log);