diff --git a/src/core/log.c b/src/core/log.c index 9617b0c5..112e46b6 100644 --- a/src/core/log.c +++ b/src/core/log.c @@ -348,6 +348,7 @@ LOG_REC *log_create_rec(const char *fname, int level) if (rec == NULL) { rec = g_new0(LOG_REC, 1); rec->fname = g_strdup(fname); + rec->real_fname = log_filename(rec); rec->handle = -1; } diff --git a/src/fe-common/core/fe-log.c b/src/fe-common/core/fe-log.c index 95ab07e4..8250dd90 100644 --- a/src/fe-common/core/fe-log.c +++ b/src/fe-common/core/fe-log.c @@ -342,7 +342,7 @@ static void autologs_close_all(void) static void autolog_open(void *server, const char *target) { LOG_REC *log; - char *fname, *dir, *str; + char *fname, *dir; log = logs_find_item(LOG_ITEM_TARGET, target, server, NULL); if (log != NULL && !log->failed) { @@ -352,16 +352,13 @@ static void autolog_open(void *server, const char *target) fname = parse_special_string(autolog_path, server, NULL, target, NULL); if (log_find(fname) == NULL) { - str = convert_home(fname); - dir = g_dirname(str); - g_free(str); - - mkpath(dir, LOG_DIR_CREATE_MODE); - g_free(dir); - log = log_create_rec(fname, autolog_level); log_item_add(log, LOG_ITEM_TARGET, target, server); + dir = g_dirname(log->real_fname); + mkpath(dir, LOG_DIR_CREATE_MODE); + g_free(dir); + log->temp = TRUE; log_update(log); log_start_logging(log);