1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Add back some ifdefs.

Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
This commit is contained in:
Edward Tomasz Napierala 2017-08-09 11:06:36 +01:00
parent 5db6caee0d
commit 0c49a84ffb
6 changed files with 39 additions and 9 deletions

View File

@ -5,17 +5,9 @@ gboolean capsicum_enabled(void);
int capsicum_net_connect_ip(IPADDR *ip, int port, IPADDR *my_ip); int capsicum_net_connect_ip(IPADDR *ip, int port, IPADDR *my_ip);
int capsicum_net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6); int capsicum_net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6);
int capsicum_open(const char *path, int flags, int mode); int capsicum_open(const char *path, int flags, int mode);
void capsicum_mkdir_with_parents(const char *path, int mode);
#ifdef HAVE_CAPSICUM
int capsicum_open_wrapper(const char *path, int flags, int mode); int capsicum_open_wrapper(const char *path, int flags, int mode);
void capsicum_mkdir_with_parents(const char *path, int mode);
void capsicum_mkdir_with_parents_wrapper(const char *path, int mode); void capsicum_mkdir_with_parents_wrapper(const char *path, int mode);
#else
#define capsicum_open_wrapper(P, F, M) \
open(P, F, M)
#define capsicum_mkdir_with_parents_wrapper(P, M) \
g_mkdir_with_parents(P, M)
#endif
void capsicum_init(void); void capsicum_init(void);
void capsicum_deinit(void); void capsicum_deinit(void);

View File

@ -29,7 +29,9 @@
#include "signals.h" #include "signals.h"
#include "settings.h" #include "settings.h"
#include "session.h" #include "session.h"
#ifdef HAVE_CAPSICUM
#include "capsicum.h" #include "capsicum.h"
#endif
#include "chat-protocols.h" #include "chat-protocols.h"
#include "servers.h" #include "servers.h"

View File

@ -26,7 +26,9 @@
#include "servers.h" #include "servers.h"
#include "log.h" #include "log.h"
#include "write-buffer.h" #include "write-buffer.h"
#ifdef HAVE_CAPSICUM
#include "capsicum.h" #include "capsicum.h"
#endif
#include "lib-config/iconfig.h" #include "lib-config/iconfig.h"
#include "settings.h" #include "settings.h"
@ -115,13 +117,23 @@ int log_start_logging(LOG_REC *log)
/* path may contain variables (%time, $vars), /* path may contain variables (%time, $vars),
make sure the directory is created */ make sure the directory is created */
dir = g_path_get_dirname(log->real_fname); dir = g_path_get_dirname(log->real_fname);
#ifdef HAVE_CAPSICUM
capsicum_mkdir_with_parents_wrapper(dir, log_dir_create_mode); capsicum_mkdir_with_parents_wrapper(dir, log_dir_create_mode);
#else
g_mkdir_with_parents(dir, log_dir_create_mode);
#endif
g_free(dir); g_free(dir);
} }
#ifdef HAVE_CAPSICUM
log->handle = log->real_fname == NULL ? -1 : log->handle = log->real_fname == NULL ? -1 :
capsicum_open_wrapper(log->real_fname, O_WRONLY | O_APPEND | O_CREAT, capsicum_open_wrapper(log->real_fname, O_WRONLY | O_APPEND | O_CREAT,
log_file_create_mode); 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) { if (log->handle == -1) {
signal_emit("log create failed", 1, log); signal_emit("log create failed", 1, log);
log->failed = TRUE; log->failed = TRUE;

View File

@ -27,7 +27,9 @@
#include "misc.h" #include "misc.h"
#include "write-buffer.h" #include "write-buffer.h"
#include "settings.h" #include "settings.h"
#ifdef HAVE_CAPSICUM
#include "capsicum.h" #include "capsicum.h"
#endif
#include "servers.h" #include "servers.h"
@ -127,9 +129,15 @@ void rawlog_open(RAWLOG_REC *rawlog, const char *fname)
return; return;
path = convert_home(fname); path = convert_home(fname);
#ifdef HAVE_CAPSICUM
rawlog->handle = capsicum_open_wrapper(path, rawlog->handle = capsicum_open_wrapper(path,
O_WRONLY | O_APPEND | O_CREAT, O_WRONLY | O_APPEND | O_CREAT,
log_file_create_mode); log_file_create_mode);
#else
rawlog->handle = open(path, O_WRONLY | O_APPEND | O_CREAT,
log_file_create_mode);
#endif
g_free(path); g_free(path);
if (rawlog->handle == -1) { if (rawlog->handle == -1) {
@ -156,12 +164,20 @@ void rawlog_save(RAWLOG_REC *rawlog, const char *fname)
int f; int f;
dir = g_path_get_dirname(fname); dir = g_path_get_dirname(fname);
#ifdef HAVE_CAPSICUM
capsicum_mkdir_with_parents_wrapper(dir, log_dir_create_mode); capsicum_mkdir_with_parents_wrapper(dir, log_dir_create_mode);
#else
g_mkdir_with_parents(dir, log_dir_create_mode);
#endif
g_free(dir); g_free(dir);
path = convert_home(fname); path = convert_home(fname);
#ifdef HAVE_CAPSICUM
f = capsicum_open_wrapper(path, O_WRONLY | O_APPEND | O_CREAT, f = capsicum_open_wrapper(path, O_WRONLY | O_APPEND | O_CREAT,
log_file_create_mode); log_file_create_mode);
#else
f = open(path, O_WRONLY | O_APPEND | O_CREAT, log_file_create_mode);
#endif
g_free(path); g_free(path);
if (f < 0) { if (f < 0) {

View File

@ -32,7 +32,9 @@
#include "special-vars.h" #include "special-vars.h"
#include "fe-core-commands.h" #include "fe-core-commands.h"
#include "fe-queries.h" #include "fe-queries.h"
#ifdef HAVE_CAPSICUM
#include "fe-capsicum.h" #include "fe-capsicum.h"
#endif
#include "hilight-text.h" #include "hilight-text.h"
#include "command-history.h" #include "command-history.h"
#include "completion.h" #include "completion.h"

View File

@ -30,7 +30,9 @@
#include "special-vars.h" #include "special-vars.h"
#include "settings.h" #include "settings.h"
#include "lib-config/iconfig.h" #include "lib-config/iconfig.h"
#ifdef HAVE_CAPSICUM
#include "capsicum.h" #include "capsicum.h"
#endif
#include "fe-windows.h" #include "fe-windows.h"
#include "window-items.h" #include "window-items.h"
@ -452,7 +454,11 @@ static void autolog_open(SERVER_REC *server, const char *server_tag,
log_item_add(log, LOG_ITEM_TARGET, target, server_tag); log_item_add(log, LOG_ITEM_TARGET, target, server_tag);
dir = g_path_get_dirname(log->real_fname); dir = g_path_get_dirname(log->real_fname);
#ifdef HAVE_CAPSICUM
capsicum_mkdir_with_parents_wrapper(dir, log_dir_create_mode); capsicum_mkdir_with_parents_wrapper(dir, log_dir_create_mode);
#else
g_mkdir_with_parents(dir, log_dir_create_mode);
#endif
g_free(dir); g_free(dir);
log->temp = TRUE; log->temp = TRUE;