diff mbox

libmultipath: fix setting of fast_io_fail_tmo

Message ID 1477391963-9364-1-git-send-email-peng.liang5@zte.com.cn (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show

Commit Message

peng.liang5@zte.com.cn Oct. 25, 2016, 10:39 a.m. UTC
From: PengLiang <peng.liang5@zte.com.cn>

As MP_FAST_IO_FAIL_ZERO define to -2, it means -1 and -2 will be sscanf to
*int_ptr in set_fast_io_fail. Then, -1 will be snprintf to 'off' and -2 will
be snprintf to '0' in print_fast_io_fail.
So it will showing the wrong config if user set fast_io_fail_tmo to -1 or -2.
But in fact, -1 or -2 is a invalid config.

Signed-off-by: PengLiang <peng.liang5@zte.com.cn>
---
 libmultipath/dict.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 7c21e72..b02a29b 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -573,7 +573,7 @@  set_fast_io_fail(vector strvec, void *ptr)
 	if (strcmp(buff, "off") == 0)
 		*int_ptr = MP_FAST_IO_FAIL_OFF;
 	else if (sscanf(buff, "%d", int_ptr) != 1 ||
-		 *int_ptr < MP_FAST_IO_FAIL_ZERO)
+		 *int_ptr < 0)
 		*int_ptr = MP_FAST_IO_FAIL_UNSET;
 	else if (*int_ptr == 0)
 		*int_ptr = MP_FAST_IO_FAIL_ZERO;