summaryrefslogtreecommitdiffstats
path: root/patches/watchdog-5.7/0002-Replace-index-with-strchr.patch
blob: c1e31866e405c43b8987cd23f7f803d88d0c92dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From cbb4eb9d35a809c328dc0a5d6651ec504ce4435c Mon Sep 17 00:00:00 2001
From: Jon Ringle <jon@ringle.org>
Date: Wed, 3 Mar 2010 19:21:24 -0500
Subject: [PATCH 2/2] Replace index() with strchr()

uclibc does not have index(), but strchr() is equivalent
to index() according to the index man page

Signed-off-by: Jon Ringle <jon@ringle.org>
---
 src/mntent.c |    4 ++--
 src/umount.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mntent.c b/src/mntent.c
index 4d103c3..a4aeed0 100644
--- a/src/mntent.c
+++ b/src/mntent.c
@@ -8,7 +8,7 @@
 #endif
 
 #include <stdio.h>
-#include <string.h>		/* for index */
+#include <string.h>		/* for strchr */
 #include <ctype.h>		/* for isdigit */
 #include "wd_mntent.h"
 #include "sundries.h"		/* for xmalloc */
@@ -157,7 +157,7 @@ my_getmntent (mntFILE *mfp) {
 		if (fgets (buf, sizeof(buf), mfp->mntent_fp) == NULL)
 			return NULL;
 
-		s = index (buf, '\n');
+		s = strchr (buf, '\n');
 		if (s == NULL) {
 			/* extremely long line - assume file was corrupted */
 			mfp->mntent_errs = 1;
diff --git a/src/umount.c b/src/umount.c
index 8c9f08c..d5fbd0b 100644
--- a/src/umount.c
+++ b/src/umount.c
@@ -212,7 +212,7 @@ umount_one (const char *spec, const char *node, const char *type,
 	    if (res < 0)
 		 umnt_err2 = errno;
 	    /* Do not complain about remote NFS mount points */
-	    if (errno == ENOENT && index(spec, ':'))
+	    if (errno == ENOENT && strchr(spec, ':'))
 		 umnt_err2 = 0;
        }
   }
-- 
1.7.0.rc2