Revision: 2676
http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2676
Author: robertmh
Date: 2009-11-01 23:03:09 +0000 (Sun, 01 Nov 2009)
Log Message:
-----------
2009-11-01 Robert Millan <[email protected]>
Based on patch from BVK Chaitanya <[email protected]>
* kern/misc.c (grub_strchr, grub_strrchr): Fix to handle c == '\0'
case.
Modified Paths:
--------------
trunk/grub2/ChangeLog
trunk/grub2/kern/misc.c
Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog 2009-11-01 18:19:04 UTC (rev 2675)
+++ trunk/grub2/ChangeLog 2009-11-01 23:03:09 UTC (rev 2676)
@@ -1,3 +1,9 @@
+2009-11-01 Robert Millan <[email protected]>
+
+ Based on patch from BVK Chaitanya <[email protected]>
+ * kern/misc.c (grub_strchr, grub_strrchr): Fix to handle c == '\0'
+ case.
+
2009-11-01 Felix Zielcke <[email protected]>
* Makefile.in (TARGET_CPPFLAGS): Add `-I$(srcdir)/include'.
Modified: trunk/grub2/kern/misc.c
===================================================================
--- trunk/grub2/kern/misc.c 2009-11-01 18:19:04 UTC (rev 2675)
+++ trunk/grub2/kern/misc.c 2009-11-01 23:03:09 UTC (rev 2676)
@@ -223,12 +223,12 @@
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 @@
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;
}