dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Christope Varoqui <christophe.varoqui@gmail.com>
Cc: dm-devel@redhat.com
Subject: [PATCH] Correctly ignore empty prio names
Date: Wed,  8 May 2013 11:13:43 +0200	[thread overview]
Message-ID: <1368004423-8338-1-git-send-email-hare@suse.de> (raw)

This is a partial revert of commit
'Stop annoying prio_lookup warning messages',
as that patch would only fix the 'prio_put' case.
However, as the prio name might be empty even in
in prio_get() we should rather fix this in
prio_lookup() and handle both cases.

Signed-off-by: Hannes Reinecke <hare@suse.de>

diff --git a/libmultipath/prio.c b/libmultipath/prio.c
index 186cc4d..05a8cf1 100644
--- a/libmultipath/prio.c
+++ b/libmultipath/prio.c
@@ -64,6 +64,9 @@ struct prio * prio_lookup (char * name)
 {
 	struct prio * p;
 
+	if (!name || !strlen(name))
+		return NULL;
+
 	list_for_each_entry(p, &prioritizers, node) {
 		if (!strncmp(name, p->name, PRIO_NAME_LEN))
 			return p;
@@ -162,10 +165,7 @@ void prio_put (struct prio * dst)
 	if (!dst)
 		return;
 
-	if (!strlen(dst->name))
-		src = NULL;
-	else
-		src = prio_lookup(dst->name);
+	src = prio_lookup(dst->name);
 	memset(dst, 0x0, sizeof(struct prio));
 	free_prio(src);
 }

             reply	other threads:[~2013-05-08  9:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-08  9:13 Hannes Reinecke [this message]
2013-05-08  9:52 ` [PATCH] Correctly ignore empty prio names Christophe Varoqui
2013-05-08 16:28 ` Benjamin Marzinski
2013-05-10 14:48   ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368004423-8338-1-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=christophe.varoqui@gmail.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).