Blob Blame History Raw
From 2e5150be0ad662f218a5442bd1c40f12c825022d Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 19 Jun 2014 10:51:54 -0500
Subject: [PATCH] sanlock: fix get_hosts off by one

When a host_id is specified, the information for
host_id+1 is returned.

Signed-off-by: David Teigland <teigland@redhat.com>
---
 src/lockspace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lockspace.c b/src/lockspace.c
index e96e1e1e7983..6306ea7529b6 100644
--- a/src/lockspace.c
+++ b/src/lockspace.c
@@ -1078,7 +1078,7 @@ int get_hosts(struct sanlk_lockspace *ls, char *buf, int *len, int *count, int m
 	for (i = 0; i < DEFAULT_MAX_HOSTS; i++) {
 		hs = &sp->host_status[i];
 
-		if (ls->host_id && ls->host_id != i)
+		if (ls->host_id && (ls->host_id != (i + 1)))
 			continue;
 
 		if (!ls->host_id && !hs->timestamp)
-- 
1.8.3.1