summaryrefslogtreecommitdiff
path: root/src/fe-common/core
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2017-09-01 10:39:14 +0100
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2017-09-08 13:14:24 +0100
commitb529e1a9df134bbc5618752abcf19af0110b6868 (patch)
tree0f1a9618d6221fb4909891e1961a08d063f4369a /src/fe-common/core
parent245a3fd4c1afb86b38eb17477a42c60c52cef793 (diff)
downloadirssi-b529e1a9df134bbc5618752abcf19af0110b6868.zip
Fix /back in Capsicum capability mode.
Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
Diffstat (limited to 'src/fe-common/core')
-rw-r--r--src/fe-common/core/fe-core-commands.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/fe-common/core/fe-core-commands.c b/src/fe-common/core/fe-core-commands.c
index 97a246ec..fb98cc25 100644
--- a/src/fe-common/core/fe-core-commands.c
+++ b/src/fe-common/core/fe-core-commands.c
@@ -28,6 +28,9 @@
#include "settings.h"
#include "irssi-version.h"
#include "servers.h"
+#ifdef HAVE_CAPSICUM
+#include "capsicum.h"
+#endif
#include "fe-windows.h"
#include "printtext.h"
@@ -120,6 +123,9 @@ static void cmd_cat(const char *data)
GIOChannel *handle;
GString *buf;
gsize tpos;
+#ifdef HAVE_CAPSICUM
+ int fd;
+#endif
if (!cmd_get_params(data, &free_arg, 2, &fname, &fposstr))
return;
@@ -128,7 +134,15 @@ static void cmd_cat(const char *data)
fpos = atoi(fposstr);
cmd_params_free(free_arg);
+#ifdef HAVE_CAPSICUM
+ fd = capsicum_open_wrapper(fname, O_RDONLY, 0);
+ if (fd > 0)
+ handle = g_io_channel_unix_new(fd);
+ else
+ handle = NULL;
+#else
handle = g_io_channel_new_file(fname, "r", NULL);
+#endif
g_free(fname);
if (handle == NULL) {