Blame SOURCES/lvm2-2_03_03-generators-avoid-contacting-syslog-with-generators.patch

146ac4
 WHATS_NEW                     | 1 +
146ac4
 lib/log/log.c                 | 3 +++
146ac4
 man/lvm.8_main                | 3 +++
146ac4
 scripts/generator-internals.c | 3 +++
146ac4
 4 files changed, 10 insertions(+)
146ac4
146ac4
diff --git a/WHATS_NEW b/WHATS_NEW
146ac4
index 4b68dbd..26628c3 100644
146ac4
--- a/WHATS_NEW
146ac4
+++ b/WHATS_NEW
146ac4
@@ -1,5 +1,6 @@
146ac4
 Version 2.03.03 - 
146ac4
 ====================================
146ac4
+  Introduce LVM_SUPPRESS_SYSLOG to suppress syslog usage by generator.
146ac4
   Fix generator querying config options missing from lvm.conf.
146ac4
   Restore missing man info lvcreate --zero for thin-pools.
146ac4
   Drop misleadning comment for metadata minimum_io_size for VDO segment.
146ac4
diff --git a/lib/log/log.c b/lib/log/log.c
146ac4
index fd056b1..f6aaa04 100644
146ac4
--- a/lib/log/log.c
146ac4
+++ b/lib/log/log.c
146ac4
@@ -324,6 +324,9 @@ void init_log_while_suspended(int log_while_suspended)
146ac4
 
146ac4
 void init_syslog(int facility)
146ac4
 {
146ac4
+	if (getenv("LVM_SUPPRESS_SYSLOG"))
146ac4
+		return;
146ac4
+
146ac4
 	openlog("lvm", LOG_PID, facility);
146ac4
 	_syslog = 1;
146ac4
 }
146ac4
diff --git a/man/lvm.8_main b/man/lvm.8_main
146ac4
index b9abf58..3e67b1b 100644
146ac4
--- a/man/lvm.8_main
146ac4
+++ b/man/lvm.8_main
146ac4
@@ -435,6 +435,9 @@ Defaults to "\fI#DEFAULT_SYS_DIR#\fP".
146ac4
 .B LVM_SUPPRESS_FD_WARNINGS
146ac4
 Suppress warnings about unexpected file descriptors passed into LVM.
146ac4
 .TP
146ac4
+.B LVM_SUPPRESS_SYSLOG
146ac4
+Suppress contacting syslog.
146ac4
+.TP
146ac4
 .B LVM_VG_NAME
146ac4
 The Volume Group name that is assumed for
146ac4
 any reference to a Logical Volume that doesn't specify a path.
146ac4
diff --git a/scripts/generator-internals.c b/scripts/generator-internals.c
146ac4
index 7bab4f9..f7e32b0 100644
146ac4
--- a/scripts/generator-internals.c
146ac4
+++ b/scripts/generator-internals.c
146ac4
@@ -56,6 +56,9 @@ static bool _open_child(struct child_process *child, const char *cmd, const char
146ac4
 			(void) close(pipe_fd[1]);
146ac4
 		}
146ac4
 
146ac4
+		/* Suppressing any use of syslog */
146ac4
+		(void) setenv("LVM_SUPPRESS_SYSLOG", "1", 1);
146ac4
+
146ac4
 		if (execv(cmd, (char *const *) argv) < 0)
146ac4
 			_error("execv failed: %s\n", strerror(errno));
146ac4
 		// Shouldn't get here unless exec failed.