]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Avoid multi-arch strchr in tzdata-update
authorH.J. Lu <hongjiu.lu@intel.com>
Mon, 2 Nov 2009 12:15:34 +0000 (13:15 +0100)
committerAndreas Schwab <schwab@redhat.com>
Mon, 2 Nov 2009 12:15:34 +0000 (13:15 +0100)
fedora/tzdata-update.c

index f94f9a2609ee8707d87c9d5ca776ed14e8f16dd5..988fb556367288ced8d8808dfa407ea8ae63c48a 100644 (file)
@@ -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')