mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Create log file directories using /set log_create_file_mode + exec-bit.
Patch by Noah Levitt <nlevitt at columbia.edu> git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3022 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
ecff491e02
commit
ad27d4aac4
@ -47,6 +47,7 @@ static const char *log_item_types[] = {
|
|||||||
|
|
||||||
const char *log_timestamp;
|
const char *log_timestamp;
|
||||||
static int log_file_create_mode;
|
static int log_file_create_mode;
|
||||||
|
static int log_dir_create_mode;
|
||||||
static int rotate_tag;
|
static int rotate_tag;
|
||||||
|
|
||||||
static int log_item_str2type(const char *type)
|
static int log_item_str2type(const char *type)
|
||||||
@ -116,7 +117,7 @@ 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_dirname(log->real_fname);
|
dir = g_dirname(log->real_fname);
|
||||||
mkpath(dir, LOG_DIR_CREATE_MODE);
|
mkpath(dir, log_dir_create_mode);
|
||||||
g_free(dir);
|
g_free(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,6 +558,11 @@ static void read_settings(void)
|
|||||||
{
|
{
|
||||||
log_timestamp = settings_get_str("log_timestamp");
|
log_timestamp = settings_get_str("log_timestamp");
|
||||||
log_file_create_mode = octal2dec(settings_get_int("log_create_mode"));
|
log_file_create_mode = octal2dec(settings_get_int("log_create_mode"));
|
||||||
|
|
||||||
|
log_dir_create_mode = log_file_create_mode;
|
||||||
|
if (log_file_create_mode & 0400) log_dir_create_mode |= 0100;
|
||||||
|
if (log_file_create_mode & 0040) log_dir_create_mode |= 0010;
|
||||||
|
if (log_file_create_mode & 0004) log_dir_create_mode |= 0001;
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_init(void)
|
void log_init(void)
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#ifndef __LOG_H
|
#ifndef __LOG_H
|
||||||
#define __LOG_H
|
#define __LOG_H
|
||||||
|
|
||||||
#define LOG_DIR_CREATE_MODE 0700
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
LOG_ITEM_TARGET, /* channel, query, .. */
|
LOG_ITEM_TARGET, /* channel, query, .. */
|
||||||
LOG_ITEM_WINDOW_REFNUM
|
LOG_ITEM_WINDOW_REFNUM
|
||||||
|
@ -48,6 +48,8 @@ static THEME_REC *log_theme;
|
|||||||
static int skip_next_printtext;
|
static int skip_next_printtext;
|
||||||
static const char *log_theme_name;
|
static const char *log_theme_name;
|
||||||
|
|
||||||
|
static int log_dir_create_mode;
|
||||||
|
|
||||||
static char *log_colorizer_strip(const char *str)
|
static char *log_colorizer_strip(const char *str)
|
||||||
{
|
{
|
||||||
return strip_codes(str);
|
return strip_codes(str);
|
||||||
@ -438,7 +440,7 @@ 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_dirname(log->real_fname);
|
dir = g_dirname(log->real_fname);
|
||||||
mkpath(dir, LOG_DIR_CREATE_MODE);
|
mkpath(dir, log_dir_create_mode);
|
||||||
g_free(dir);
|
g_free(dir);
|
||||||
|
|
||||||
log->temp = TRUE;
|
log->temp = TRUE;
|
||||||
@ -665,6 +667,7 @@ static void sig_theme_destroyed(THEME_REC *theme)
|
|||||||
static void read_settings(void)
|
static void read_settings(void)
|
||||||
{
|
{
|
||||||
int old_autolog = autolog_level;
|
int old_autolog = autolog_level;
|
||||||
|
int log_file_create_mode;
|
||||||
|
|
||||||
autolog_path = settings_get_str("autolog_path");
|
autolog_path = settings_get_str("autolog_path");
|
||||||
autolog_level = !settings_get_bool("autolog") ? 0 :
|
autolog_level = !settings_get_bool("autolog") ? 0 :
|
||||||
@ -684,6 +687,12 @@ static void read_settings(void)
|
|||||||
|
|
||||||
log_theme = log_theme_name == NULL ? NULL :
|
log_theme = log_theme_name == NULL ? NULL :
|
||||||
theme_load(log_theme_name);
|
theme_load(log_theme_name);
|
||||||
|
|
||||||
|
log_file_create_mode = octal2dec(settings_get_int("log_create_mode"));
|
||||||
|
log_dir_create_mode = log_file_create_mode;
|
||||||
|
if (log_file_create_mode & 0400) log_dir_create_mode |= 0100;
|
||||||
|
if (log_file_create_mode & 0040) log_dir_create_mode |= 0010;
|
||||||
|
if (log_file_create_mode & 0004) log_dir_create_mode |= 0001;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fe_log_init(void)
|
void fe_log_init(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user