]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-11-01 Robert Millan <rmh.grub@aybabtu.com>
authorrobertmh <robertmh@localhost>
Sun, 1 Nov 2009 23:03:09 +0000 (23:03 +0000)
committerrobertmh <robertmh@localhost>
Sun, 1 Nov 2009 23:03:09 +0000 (23:03 +0000)
        Based on patch from BVK Chaitanya  <bvk.groups@gmail.com>
        * kern/misc.c (grub_strchr, grub_strrchr): Fix to handle c == '\0'
        case.

ChangeLog
kern/misc.c

index 2e5c7484d8010f330af44738912f60bfc7a45f46..5a3f80e05d4e2c6dd49bb25e6e91b78c4465cc13 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-01  Robert Millan  <rmh.grub@aybabtu.com>
+
+       Based on patch from BVK Chaitanya  <bvk.groups@gmail.com>
+       * kern/misc.c (grub_strchr, grub_strrchr): Fix to handle c == '\0'
+       case.
+
 2009-11-01  Felix Zielcke  <fzielcke@z-51.de>
 
        * Makefile.in (TARGET_CPPFLAGS): Add `-I$(srcdir)/include'.
index 1c38fe661baed462a85d370bdded6f4cf67e4d84..cacfbc7532416d6e6048b75ad80ac061c128c2ba 100644 (file)
@@ -223,12 +223,12 @@ grub_strncmp (const char *s1, const char *s2, grub_size_t n)
 char *
 grub_strchr (const char *s, int c)
 {
-  while (*s)
+  do
     {
       if (*s == c)
        return (char *) s;
-      s++;
     }
+  while (*s++);
 
   return 0;
 }
@@ -236,14 +236,14 @@ grub_strchr (const char *s, int c)
 char *
 grub_strrchr (const char *s, int c)
 {
-  char *p = 0;
+  char *p = NULL;
 
-  while (*s)
+  do
     {
       if (*s == c)
        p = (char *) s;
-      s++;
     }
+  while (*s++);
 
   return p;
 }