[LTP] [PATCH] cpuset_lib: Replace index() with strchr()
Alistair Strachan
astrachan@google.com
Wed Jul 11 18:49:24 CEST 2018
The index() function was removed in POSIX.2008. It is not implemented by
Android's bionic C library for 64-bit platforms.
Use the more portable strchr() function from C89.
Signed-off-by: Alistair Strachan <astrachan@google.com>
---
testcases/kernel/controllers/cpuset/cpuset_lib/cpuinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/kernel/controllers/cpuset/cpuset_lib/cpuinfo.c b/testcases/kernel/controllers/cpuset/cpuset_lib/cpuinfo.c
index c2a60b683..575a61bcd 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_lib/cpuinfo.c
+++ b/testcases/kernel/controllers/cpuset/cpuset_lib/cpuinfo.c
@@ -59,7 +59,7 @@ static int get_cpu_baseinfo(void)
/* get cpuinfo */
while (fgets(buf, sizeof(buf), fp) != NULL) {
istr = strtok_r(buf, "\t", &saveptr);
- valstr = index(saveptr, ':');
+ valstr = strchr(saveptr, ':');
if (valstr == NULL)
continue;
valstr++;
More information about the ltp
mailing list