summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2015-05-29 09:54:47 -0500
committerDavid Teigland <teigland@redhat.com>2015-06-02 11:39:34 -0500
commitcdff5cb1695cab77dbebef0833b8a6c71cba6437 (patch)
treed48a384c1c11bda86fedf6b0d51792cf197abb6d
parentf1fbedf439309d3a82fff5157d719de0ac9e3897 (diff)
downloadlvm2-cdff5cb1695cab77dbebef0833b8a6c71cba6437.tar.gz
lib lvmlockd: fix segfault in logging result flags
-rw-r--r--lib/locking/lvmlockd.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 600280d3c..0865aa230 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -138,8 +138,8 @@ static void _flags_str_to_lockd_flags(const char *flags_str, uint32_t *lockd_fla
static int _lockd_result(daemon_reply reply, int *result, uint32_t *lockd_flags)
{
int reply_result;
- const char *flags_str;
- const char *lock_type;
+ const char *flags_str = NULL;
+ const char *lock_type = NULL;
if (reply.error) {
log_error("lockd_result reply error %d", reply.error);
@@ -162,15 +162,13 @@ static int _lockd_result(daemon_reply reply, int *result, uint32_t *lockd_flags)
*result = reply_result;
- if (!lockd_flags)
- goto out;
-
- flags_str = daemon_reply_str(reply, "result_flags", NULL);
- if (flags_str)
- _flags_str_to_lockd_flags(flags_str, lockd_flags);
+ if (lockd_flags) {
+ if ((flags_str = daemon_reply_str(reply, "result_flags", NULL)))
+ _flags_str_to_lockd_flags(flags_str, lockd_flags);
+ }
- out:
- log_debug("lockd_result %d %s lm %s", reply_result, flags_str, lock_type);
+ log_debug("lockd_result %d flags %s lm %s", reply_result,
+ flags_str ? flags_str : "none", lock_type);
return 1;
}