1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

o log/overwrite=1 in config file to overwrite instead of append to log

This commit is contained in:
Alasdair Kergon 2001-10-25 17:25:48 +00:00
parent d7c5efe663
commit 4bc89a2b98

View File

@ -556,12 +556,17 @@ struct dev_filter *active_filter(void)
static void __init_log(struct config_file *cf) static void __init_log(struct config_file *cf)
{ {
char *open_mode = "a";
const char *log_file = find_config_str(cf->root, "log/file", '/', 0); const char *log_file = find_config_str(cf->root, "log/file", '/', 0);
int verbose_level; int verbose_level;
if (find_config_int(cf->root, "log/overwrite", '/', 0))
open_mode = "w";
if (log_file) { if (log_file) {
/* set up the logging */ /* set up the logging */
if (!(_log = fopen(log_file, "a"))) if (!(_log = fopen(log_file, open_mode)))
log_error("Couldn't open log file %s", log_file); log_error("Couldn't open log file %s", log_file);
else else
init_log(_log); init_log(_log);