summary refs log tree commit diff
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2009-11-02 13:15:34 +0100
committerAndreas Schwab <schwab@redhat.com>2009-11-02 13:15:34 +0100
commit27a4a1d867462f6faeb93bfaf6ced524f428fe39 (patch)
tree45a884c468d137d12c01f6de44ee356abbd06d46
parent587045f460bb324b47dcae7567bf186222538a56 (diff)
downloadglibc-27a4a1d867462f6faeb93bfaf6ced524f428fe39.tar.gz
glibc-27a4a1d867462f6faeb93bfaf6ced524f428fe39.tar.xz
glibc-27a4a1d867462f6faeb93bfaf6ced524f428fe39.zip
Avoid multi-arch strchr in tzdata-update
-rw-r--r--fedora/tzdata-update.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fedora/tzdata-update.c b/fedora/tzdata-update.c
index f94f9a2609..988fb55636 100644
--- a/fedora/tzdata-update.c
+++ b/fedora/tzdata-update.c
@@ -483,6 +483,15 @@ clean_up:
     INTERNAL_SYSCALL (unlink, err, 1, tempfilename);
 }
 
+static char *
+simple_strchr (const char *s, int c)
+{
+  for (; *s != (char) c; ++s)
+    if (*s == '\0')
+      return NULL;
+  return (char *) s;
+}
+
 int
 main (int argc, char **argv)
 {
@@ -508,7 +517,7 @@ main (int argc, char **argv)
 	      while (*p == ' ' || *p == '\t') p++;
 	      if (*p == '"') p++;
 	      char *q = p;
-	      while (strchr (" \t\n\"", *p) == NULL) p++;
+	      while (simple_strchr (" \t\n\"", *p) == NULL) p++;
 	      const char path[] = "/usr/share/zoneinfo/";
 	      if (p - q >= sizeof (zonename) - sizeof (path))
 		return 0;
@@ -517,7 +526,7 @@ main (int argc, char **argv)
 	      break;
 	    }
 	}
-      p = strchr (p, '\n');
+      p = simple_strchr (p, '\n');
       if (p) p++;
     }
   if (*zonename == '\0')