summaryrefslogtreecommitdiff
path: root/src/core/rawlog.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/rawlog.c
parent939371aa1dfdbf11fe98648e1eafc4c95e80bb9e (diff)
downloadirssi-241dd66ac11d54b37c671cd56f1320fe5b83803d.zip
Working /log and /rawlog.
Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
Diffstat (limited to 'src/core/rawlog.c')
-rw-r--r--src/core/rawlog.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/core/rawlog.c b/src/core/rawlog.c
index 2ec155fa..5df02981 100644
--- a/src/core/rawlog.c
+++ b/src/core/rawlog.c
@@ -27,12 +27,25 @@
#include "misc.h"
#include "write-buffer.h"
#include "settings.h"
+#ifdef HAVE_CAPSICUM
+#include "capsicum.h"
+#endif
#include "servers.h"
static int rawlog_lines;
static int signal_rawlog;
+static int rawlog_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);
+}
+
RAWLOG_REC *rawlog_create(void)
{
RAWLOG_REC *rec;
@@ -126,7 +139,7 @@ void rawlog_open(RAWLOG_REC *rawlog, const char *fname)
return;
path = convert_home(fname);
- rawlog->handle = open(path, O_WRONLY | O_APPEND | O_CREAT,
+ rawlog->handle = rawlog_open_wrapper(path, O_WRONLY | O_APPEND | O_CREAT,
log_file_create_mode);
g_free(path);
@@ -158,7 +171,7 @@ void rawlog_save(RAWLOG_REC *rawlog, const char *fname)
g_free(dir);
path = convert_home(fname);
- f = open(path, O_WRONLY | O_APPEND | O_CREAT, log_file_create_mode);
+ f = rawlog_open_wrapper(path, O_WRONLY | O_APPEND | O_CREAT, log_file_create_mode);
g_free(path);
if (f < 0) {