fix syslog setting
This commit is contained in:
parent
c5cb9c4b42
commit
80ce2aa016
94
0031-fix-syslog-setting.patch
Normal file
94
0031-fix-syslog-setting.patch
Normal file
@ -0,0 +1,94 @@
|
||||
From 062ea3c4181ef158620556bbab2358bc76eeab90 Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Mon, 11 Oct 2021 17:08:05 -0500
|
||||
Subject: [PATCH] fix syslog setting
|
||||
|
||||
Just setting lvm.conf level=N should not send messages to
|
||||
syslog (now the journal by default.)
|
||||
|
||||
Sending messages to syslog should require setting lvm.conf
|
||||
log { syslog=1 level=N }.
|
||||
|
||||
---
|
||||
lib/commands/toolcontext.c | 9 +++------
|
||||
lib/config/defaults.h | 2 +-
|
||||
lib/log/log.c | 6 +++++-
|
||||
lib/log/lvm-logging.h | 2 +-
|
||||
4 files changed, 10 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
|
||||
index 894c91d..981c025 100644
|
||||
--- a/lib/commands/toolcontext.c
|
||||
+++ b/lib/commands/toolcontext.c
|
||||
@@ -331,12 +331,11 @@ static void _init_logging(struct cmd_context *cmd)
|
||||
|
||||
/* Syslog */
|
||||
cmd->default_settings.syslog = find_config_tree_bool(cmd, log_syslog_CFG, NULL);
|
||||
- if (cmd->default_settings.syslog != 1)
|
||||
+ if (cmd->default_settings.syslog)
|
||||
+ init_syslog(1, DEFAULT_LOG_FACILITY);
|
||||
+ else
|
||||
fin_syslog();
|
||||
|
||||
- if (cmd->default_settings.syslog > 1)
|
||||
- init_syslog(cmd->default_settings.syslog);
|
||||
-
|
||||
/* Debug level for log file output */
|
||||
cmd->default_settings.debug = find_config_tree_int(cmd, log_level_CFG, NULL);
|
||||
init_debug(cmd->default_settings.debug);
|
||||
@@ -1582,8 +1581,6 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
|
||||
bindtextdomain(INTL_PACKAGE, LOCALEDIR);
|
||||
#endif
|
||||
|
||||
- init_syslog(DEFAULT_LOG_FACILITY);
|
||||
-
|
||||
if (!(cmd = zalloc(sizeof(*cmd)))) {
|
||||
log_error("Failed to allocate command context");
|
||||
return NULL;
|
||||
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
|
||||
index 3f0539e..7e391ab 100644
|
||||
--- a/lib/config/defaults.h
|
||||
+++ b/lib/config/defaults.h
|
||||
@@ -219,7 +219,7 @@
|
||||
#endif
|
||||
|
||||
#define DEFAULT_COMMAND_LOG_REPORT 0
|
||||
-#define DEFAULT_SYSLOG 1
|
||||
+#define DEFAULT_SYSLOG 0
|
||||
#define DEFAULT_VERBOSE 0
|
||||
#define DEFAULT_SILENT 0
|
||||
#define DEFAULT_LOGLEVEL 0
|
||||
diff --git a/lib/log/log.c b/lib/log/log.c
|
||||
index 15ffb69..700be5e 100644
|
||||
--- a/lib/log/log.c
|
||||
+++ b/lib/log/log.c
|
||||
@@ -311,8 +311,12 @@ void init_log_while_suspended(int log_while_suspended)
|
||||
_log_while_suspended = log_while_suspended;
|
||||
}
|
||||
|
||||
-void init_syslog(int facility)
|
||||
+void init_syslog(int enable, int facility)
|
||||
{
|
||||
+ if (!enable) {
|
||||
+ _syslog = 0;
|
||||
+ return;
|
||||
+ }
|
||||
if (getenv("LVM_SUPPRESS_SYSLOG"))
|
||||
return;
|
||||
|
||||
diff --git a/lib/log/lvm-logging.h b/lib/log/lvm-logging.h
|
||||
index 39108fc..1be8f8f 100644
|
||||
--- a/lib/log/lvm-logging.h
|
||||
+++ b/lib/log/lvm-logging.h
|
||||
@@ -59,7 +59,7 @@ void init_abort_on_internal_errors(int fatal);
|
||||
void fin_log(void);
|
||||
void reset_log_duplicated(void);
|
||||
|
||||
-void init_syslog(int facility);
|
||||
+void init_syslog(int enable, int facility);
|
||||
void fin_syslog(void);
|
||||
|
||||
int error_message_produced(void);
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
Name: lvm2
|
||||
Version: 2.03.09
|
||||
Release: 20
|
||||
Release: 21
|
||||
Epoch: 8
|
||||
Summary: Tools for logical volume management
|
||||
License: GPLv2+ and LGPLv2.1 and BSD
|
||||
@ -79,6 +79,7 @@ patch27: 0027-clean-up-group-struct-in-_stats_create_group-error-path.patch
|
||||
Patch28: 0028-vgchange-acquire-an-exclusive-VG-lock-for-refresh.patch
|
||||
Patch29: 0029-use-4k-sector-size-when-any-dev-is-4k.patch
|
||||
Patch30: 0030-dmstats-Fix-memory-leak-on-error-path.patch
|
||||
Patch31: 0031-fix-syslog-setting.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gcc-c++
|
||||
@ -504,6 +505,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Oct 30 2024 yanshuai <yanshuai@kylinos.cn> - 8:2.03.09-21
|
||||
- fix syslog setting
|
||||
|
||||
* Wed Oct 23 2024 yanshuai <yanshuai@kylinos.cn> - 8:2.03.09-20
|
||||
- dmstats: Fix memory leak on error path
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user