File multipath-tools-display-checker-name-on-failure of Package multipath-tools

From 2abb4feab7683ba7946a3cf387568de3f7312df3 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 13 Jan 2009 15:28:23 +0100
Subject: [PATCH] Checker name is not displayed on failure

If add_checker() isn't able to locate the checker
it won't display the name in free_checker().

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/checkers.c |    5 +++--
 libmultipath/prio.c     |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
index 4378621..e1789e5 100644
--- a/libmultipath/checkers.c
+++ b/libmultipath/checkers.c
@@ -87,10 +87,12 @@ struct checker * add_checker (char * name)
 	c = alloc_checker();
 	if (!c)
 		return NULL;
+	snprintf(c->name, CHECKER_NAME_LEN, "%s", name);
 	snprintf(libname, LIB_CHECKER_NAMELEN, "%s/libcheck%s.so",
 		 conf->multipath_dir, name);
 	if (stat(libname,&stbuf) < 0) {
-		condlog(0,"Invalid checker '%s'", name);
+		condlog(0,"Checker '%s' not found in %s",
+			name, conf->multipath_dir);
 		goto out;
 	}
 	condlog(3, "loading %s checker", libname);
@@ -122,7 +124,6 @@ struct checker * add_checker (char * name)
 	if (!c->free)
 		goto out;
 
-	snprintf(c->name, CHECKER_NAME_LEN, "%s", name);
 	c->fd = 0;
 	c->sync = 1;
 	list_add(&c->node, &checkers);
diff --git a/libmultipath/prio.c b/libmultipath/prio.c
index 30e03c2..7508a8a 100644
--- a/libmultipath/prio.c
+++ b/libmultipath/prio.c
@@ -71,10 +71,12 @@ struct prio * add_prio (char * name)
 	p = alloc_prio();
 	if (!p)
 		return NULL;
+	snprintf(p->name, PRIO_NAME_LEN, "%s", name);
 	snprintf(libname, LIB_PRIO_NAMELEN, "%s/libprio%s.so",
 		 conf->multipath_dir, name);
 	if (stat(libname,&stbuf) < 0) {
-		condlog(0,"Invalid prioritizer '%s'", name);
+		condlog(0,"Prioritizer '%s' not found in %s",
+			name, conf->multipath_dir);
 		goto out;
 	}
 	condlog(3, "loading %s prioritizer", libname);
@@ -91,7 +93,6 @@ struct prio * add_prio (char * name)
 		condlog(0, "A dynamic linking error occurred: (%s)", errstr);
 	if (!p->getprio)
 		goto out;
-	snprintf(p->name, PRIO_NAME_LEN, "%s", name);
 	list_add(&p->node, &prioritizers);
 	return p;
 out:
-- 
1.5.3.2

openSUSE Build Service is sponsored by