From b529e1a9df134bbc5618752abcf19af0110b6868 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Fri, 1 Sep 2017 10:39:14 +0100 Subject: [PATCH] Fix /back in Capsicum capability mode. Signed-off-by: Edward Tomasz Napierala --- src/fe-common/core/fe-core-commands.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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) {