File ndctl-Fix-the-NDCTL_TIMEOUT-environment-variable-par.patch of Package ndctl.28139
From 61229759bfd184554a502654a0af83b40851cbbf Mon Sep 17 00:00:00 2001
From: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Date: Fri, 4 Nov 2022 07:31:02 +0000
Subject: [PATCH] ndctl: Fix the NDCTL_TIMEOUT environment variable parsing
Patch-mainline: v75
Git-commit: 61229759bfd184554a502654a0af83b40851cbbf
The strtoul(x, y, size) returns empty string on y when the x is only
a number with no other suffix strings. The code is checking if !null
instead of comparing with an empty string.
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Link: https://lore.kernel.org/r/166754703982.18057.1825839184901260588.stgit@fedora
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
ndctl/lib/libndctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index ad54f06..77c31ab 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -334,7 +334,7 @@ NDCTL_EXPORT int ndctl_new(struct ndctl_ctx **ctx)
char *end;
tmo = strtoul(env, &end, 0);
- if (tmo < ULONG_MAX && !end)
+ if (tmo < ULONG_MAX && !*end)
c->timeout = tmo;
dbg(c, "timeout = %ld\n", tmo);
}
--
2.39.1