termux-packages/packages/procps/sysctl.c.patch
Fredrik Fornwall f3529fc164 procps: Replace index() by strchr()
The index() function has been removed from 64-bit libc and is
a deprecated posix function.
2016-01-03 21:27:59 -05:00

42 lines
901 B
Diff

diff -u -r ../procps-ng-3.3.11/sysctl.c ./sysctl.c
--- ../procps-ng-3.3.11/sysctl.c 2015-08-09 01:54:54.306117153 -0400
+++ ./sysctl.c 2016-01-03 21:27:00.921667943 -0500
@@ -29,7 +29,9 @@
#include <dirent.h>
#include <errno.h>
#include <getopt.h>
-#include <glob.h>
+#ifndef __ANDROID__
+# include <glob.h>
+#endif
#include <libgen.h>
#include <limits.h>
#include <regex.h>
@@ -491,6 +493,9 @@
*/
static int Preload(const char *restrict const filename)
{
+#ifdef __ANDROID__
+ return -1;
+#else
char oneline[LINELEN];
char buffer[LINELEN];
FILE *fp;
@@ -567,6 +572,7 @@
fclose(fp);
}
return rc;
+#endif
}
struct pair {
@@ -816,7 +822,7 @@
program_invocation_short_name);
for ( ; *argv; argv++) {
- if (WriteMode || index(*argv, '='))
+ if (WriteMode || strchr(*argv, '='))
ReturnCode += WriteSetting(*argv);
else
ReturnCode += ReadSetting(*argv);