[dm-devel] [PATCH v2 12/13] libmultipath: fix compilation error with clang 13

mwilck at suse.com mwilck at suse.com
Mon Nov 29 20:09:01 UTC 2021


From: Martin Wilck <mwilck at suse.com>

This fixes the following error emitted by clang 13:

weightedpath.c:67:8: error: variable 'arg' set but not used [-Werror,-Wunused-but-set-variable]
	char *arg __attribute__((cleanup(cleanup_charp))) = NULL;

Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 libmultipath/prioritizers/weightedpath.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libmultipath/prioritizers/weightedpath.c b/libmultipath/prioritizers/weightedpath.c
index 6f20e8f..561ebb4 100644
--- a/libmultipath/prioritizers/weightedpath.c
+++ b/libmultipath/prioritizers/weightedpath.c
@@ -74,7 +74,8 @@ int prio_path_weight(struct path *pp, char *prio_args)
 	if (!prio_args)
 		return priority;
 
-	arg = temp = strdup(prio_args);
+	arg = strdup(prio_args);
+	temp = arg;
 
 	regex = get_next_string(&temp, split_char);
 
-- 
2.33.1





More information about the dm-devel mailing list