[dm-devel] [PATCH 2/3] libmultipath: fix compilation on systems without systemd

Anthony Iliopoulos ailiop at suse.com
Mon Oct 19 11:20:16 UTC 2020


Hide set_max_checkint_from_watchdog and its invocation completely behind
ifdefs to avoid breaking compilation on non-systemd environments.
Otherwise gcc bails out due to -Werror since it detects an unused
parameter to the function.

Signed-off-by: Anthony Iliopoulos <ailiop at suse.com>
---
 libmultipath/config.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libmultipath/config.c b/libmultipath/config.c
index b4d87689eab3..658bec8b81c7 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -696,9 +696,9 @@ process_config_dir(struct config *conf, char *dir)
 	pthread_cleanup_pop(1);
 }
 
+#ifdef USE_SYSTEMD
 static void set_max_checkint_from_watchdog(struct config *conf)
 {
-#ifdef USE_SYSTEMD
 	char *envp = getenv("WATCHDOG_USEC");
 	unsigned long checkint;
 
@@ -714,8 +714,8 @@ static void set_max_checkint_from_watchdog(struct config *conf)
 		condlog(3, "enabling watchdog, interval %ld", checkint);
 		conf->use_watchdog = true;
 	}
-#endif
 }
+#endif
 
 struct config *
 load_config (char * file)
@@ -789,7 +789,9 @@ load_config (char * file)
 	/*
 	 * fill the voids left in the config file
 	 */
+#ifdef USE_SYSTEMD
 	set_max_checkint_from_watchdog(conf);
+#endif
 	if (conf->max_checkint == 0) {
 		if (conf->checkint == CHECKINT_UNDEF)
 			conf->checkint = DEFAULT_CHECKINT;
-- 
2.28.0





More information about the dm-devel mailing list