summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarian Csontos <mcsontos@redhat.com>2015-07-10 15:27:56 +0200
committerMarian Csontos <mcsontos@redhat.com>2015-07-10 15:27:56 +0200
commit04b224c6f9f3e1d2e83e0663e6e7e5313ada0a99 (patch)
treedc39ed0630c12affab67e2251082f9ad028489a0
parent06041318f5a578c49cac19cb6dbf49e60c56c618 (diff)
downloadlvm2-dev-mcsontos-fixes.tar.gz
log: Empty LVM_LOG_FILE_EPOCH handlingdev-mcsontos-fixes
When env.variable is set to empty getenv returns pointer to empty string. In tests it is expected this will produce undecorated debug.log instead of debug.log__*
-rw-r--r--lib/log/log.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/log/log.c b/lib/log/log.c
index a439d1da3..3a8f4efac 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -82,7 +82,10 @@ void init_log_file(const char *log_file, int append)
log_warn("WARNING: Ignoring invalid LVM_LOG_FILE_EPOCH envvar \"%s\".", env);
goto no_epoch;
}
-
+ if (!i) {
+ log_debug("Empty LVM_LOG_FILE_EPOCH envvar set.");
+ goto no_epoch;
+ }
if (!(st = fopen(statfile, "r")))
log_sys_error("fopen", statfile);
else if (fscanf(st, "%d %*s %*c %*d %*d %*d %*d " /* tty_nr */