diff options
author | Timo Sirainen <cras@irssi.org> | 2001-10-22 21:26:58 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-10-22 21:26:58 +0000 |
commit | e4f34d9cd3b012c985a326bf925baf85b776c4c4 (patch) | |
tree | def058ec1f5196223d20ee9c92e4e75fd5409da6 /src/core | |
parent | c9f76eee75a013c929ec884c7aa981f51a9f4e0c (diff) | |
download | irssi-e4f34d9cd3b012c985a326bf925baf85b776c4c4.zip |
When logs are rotated, automatically create the new directory where to open
the log if it has changed.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1897 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/log.c | 7 | ||||
-rw-r--r-- | src/core/log.h | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/core/log.c b/src/core/log.c index 743121f7..f3cb1153 100644 --- a/src/core/log.c +++ b/src/core/log.c @@ -165,7 +165,7 @@ void log_stop_logging(LOG_REC *log) static void log_rotate_check(LOG_REC *log) { - char *new_fname; + char *new_fname, *dir; g_return_if_fail(log != NULL); @@ -177,6 +177,11 @@ static void log_rotate_check(LOG_REC *log) /* rotate log */ log_stop_logging(log); signal_emit("log rotated", 1, log); + + dir = g_dirname(new_fname); + mkpath(dir, LOG_DIR_CREATE_MODE); + g_free(dir); + log_start_logging(log); } g_free(new_fname); diff --git a/src/core/log.h b/src/core/log.h index 0bca0820..8631c7a5 100644 --- a/src/core/log.h +++ b/src/core/log.h @@ -1,6 +1,8 @@ #ifndef __LOG_H #define __LOG_H +#define LOG_DIR_CREATE_MODE 0770 + enum { LOG_ITEM_TARGET, /* channel, query, .. */ LOG_ITEM_WINDOW_REFNUM |