diff options
author | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2017-07-29 12:28:49 +0100 |
---|---|---|
committer | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2017-07-29 23:52:23 +0100 |
commit | 12e2c46d6a778f131c1ca6a7134af1cd5e722dbe (patch) | |
tree | 8ebb4c7498933f3f9ad169be7e67ef1e6745b220 /src/core/log.c | |
parent | c00d4753aee732b5a815f12dda3c9fced41ef1f5 (diff) | |
download | irssi-12e2c46d6a778f131c1ca6a7134af1cd5e722dbe.zip |
Add wrappers to reduce #ifdefs.
Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
Diffstat (limited to 'src/core/log.c')
-rw-r--r-- | src/core/log.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/core/log.c b/src/core/log.c index 9394263f..ea2f1a1d 100644 --- a/src/core/log.c +++ b/src/core/log.c @@ -26,9 +26,7 @@ #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" @@ -76,16 +74,6 @@ 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]; @@ -127,19 +115,12 @@ int log_start_logging(LOG_REC *log) /* path may contain variables (%time, $vars), make sure the directory is created */ dir = g_path_get_dirname(log->real_fname); -#ifdef HAVE_CAPSICUM - if (capsicum_enabled()) - capsicum_mkdir_with_parents(dir, log_dir_create_mode); - else - g_mkdir_with_parents(dir, log_dir_create_mode); -#else - g_mkdir_with_parents(dir, log_dir_create_mode); -#endif + capsicum_mkdir_with_parents_wrapper(dir, log_dir_create_mode); g_free(dir); } log->handle = log->real_fname == NULL ? -1 : - log_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); if (log->handle == -1) { signal_emit("log create failed", 1, log); |