Blame SOURCES/0002-Refactor-sbd-inquisitor-functionize-striping-leading.patch

bcce97
From 8438c244cc2066fbe9c598a6392e8935cf017d97 Mon Sep 17 00:00:00 2001
bcce97
From: "Gao,Yan" <ygao@suse.com>
bcce97
Date: Fri, 25 Jun 2021 15:02:14 +0200
bcce97
Subject: [PATCH] Refactor: sbd-inquisitor: functionize striping leading spaces
bcce97
 of an option value
bcce97
bcce97
---
bcce97
 src/sbd-inquisitor.c | 11 +++++++++--
bcce97
 1 file changed, 9 insertions(+), 2 deletions(-)
bcce97
bcce97
diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c
bcce97
index 4fec2fd..53ddfa3 100644
bcce97
--- a/src/sbd-inquisitor.c
bcce97
+++ b/src/sbd-inquisitor.c
bcce97
@@ -40,9 +40,8 @@ bool sync_resource_startup = false;
bcce97
 int parse_device_line(const char *line);
bcce97
 
bcce97
 static const char *
bcce97
-get_env_option(const char *option)
bcce97
+sanitize_option_value(const char *value)
bcce97
 {
bcce97
-	const char *value = getenv(option);
bcce97
 	size_t max = 0;
bcce97
 	size_t lpc = 0;
bcce97
 
bcce97
@@ -61,6 +60,14 @@ get_env_option(const char *option)
bcce97
 	return (strlen(value + lpc) > 0 ? (value + lpc) : NULL);
bcce97
 }
bcce97
 
bcce97
+static const char *
bcce97
+get_env_option(const char *option)
bcce97
+{
bcce97
+	const char *value = getenv(option);
bcce97
+
bcce97
+	return sanitize_option_value(value);
bcce97
+}
bcce97
+
bcce97
 static int
bcce97
 recruit_servant(const char *devname, pid_t pid)
bcce97
 {
bcce97
-- 
bcce97
1.8.3.1
bcce97