1 From a1d45736286939b822fcc7b9c74843f6f90a747e Mon Sep 17 00:00:00 2001
2 From: Gustavo Zacarias <gustavo@zacarias.com.ar>
3 Date: Sat, 10 Nov 2012 18:58:15 +0100
4 Subject: [PATCH] Switch legacy index() in favour of strchr() Updated for 1.2.6
5 from the previous patch by Frederik Pasch.
7 Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
9 support/nfs/nfs_mntent.c | 6 +++---
10 utils/mount/error.c | 2 +-
11 utils/mountd/fsloc.c | 2 +-
12 3 files changed, 5 insertions(+), 5 deletions(-)
14 diff --git a/support/nfs/nfs_mntent.c b/support/nfs/nfs_mntent.c
15 index a2118a2..7496ed6 100644
16 --- a/support/nfs/nfs_mntent.c
17 +++ b/support/nfs/nfs_mntent.c
22 -#include <string.h> /* for index */
23 +#include <string.h> /* for strchr */
24 #include <ctype.h> /* for isdigit */
25 #include <sys/stat.h> /* for umask */
26 #include <unistd.h> /* for ftruncate */
27 @@ -172,7 +172,7 @@ nfs_getmntent (mntFILE *mfp) {
31 - s = index (buf, '\n');
32 + s = strchr (buf, '\n');
34 /* Missing final newline? Otherwise extremely */
35 /* long line - assume file was corrupted */
36 @@ -180,7 +180,7 @@ nfs_getmntent (mntFILE *mfp) {
37 fprintf(stderr, _("[mntent]: warning: no final "
38 "newline at the end of %s\n"),
41 + s = strchr (buf, 0);
45 diff --git a/utils/mount/error.c b/utils/mount/error.c
46 index e06f598..7bd1d27 100644
47 --- a/utils/mount/error.c
48 +++ b/utils/mount/error.c
49 @@ -62,7 +62,7 @@ static int rpc_strerror(int spos)
53 - if ((ptr = index(estr, ':')))
54 + if ((ptr = strchr(estr, ':')))
58 diff --git a/utils/mountd/fsloc.c b/utils/mountd/fsloc.c
59 index bc737d1..ddbe92f 100644
60 --- a/utils/mountd/fsloc.c
61 +++ b/utils/mountd/fsloc.c
62 @@ -127,7 +127,7 @@ static struct servers *method_list(char *data)
65 xlog(L_NOTICE, "method_list(%s)", data);
66 - for (ptr--, listsize=1; ptr; ptr=index(ptr, ':'), listsize++)
67 + for (ptr--, listsize=1; ptr; ptr=strchr(ptr, ':'), listsize++)
69 list = malloc(listsize * sizeof(char *));