cpuset_lib: Replace index() with strchr()

Message ID 20180711164925.65342-1-astrachan@google.com
State New
Headers show
Series
  • cpuset_lib: Replace index() with strchr()
Related show

Commit Message

Alistair Strachan July 11, 2018, 4:49 p.m.
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(-)

Patch

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++;