Fix failing printf test.

* grub-core/kern/misc.c (grub_vsnprintf_real): Parse '-', '.', and
'$' in the correct order when collecting type information.
This commit is contained in:
Colin Watson 2013-01-02 12:48:31 +00:00
parent 971dd2c6d5
commit 45d26abb40
2 changed files with 19 additions and 9 deletions

View file

@ -1,3 +1,10 @@
2013-01-02 Colin Watson <cjwatson@ubuntu.com>
Fix failing printf test.
* grub-core/kern/misc.c (grub_vsnprintf_real): Parse '-', '.', and
'$' in the correct order when collecting type information.
2013-01-02 Colin Watson <cjwatson@ubuntu.com> 2013-01-02 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (configfile): Explain environment variable * docs/grub.texi (configfile): Explain environment variable

View file

@ -741,23 +741,26 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
if (*fmt && *fmt =='-') if (*fmt && *fmt =='-')
fmt++; fmt++;
while (*fmt && grub_isdigit (*fmt))
fmt++;
if (*fmt && *fmt =='.')
fmt++;
while (*fmt && grub_isdigit (*fmt))
fmt++;
p = fmt; p = fmt;
while (*fmt && grub_isdigit (*fmt))
fmt++;
if (*fmt && *fmt == '$') if (*fmt && *fmt == '$')
{ {
curn = grub_strtoull (p, 0, 10) - 1; curn = grub_strtoull (p, 0, 10) - 1;
fmt++; fmt++;
} }
if (*fmt && *fmt =='-')
fmt++;
while (*fmt && grub_isdigit (*fmt))
fmt++;
if (*fmt && *fmt =='.')
fmt++;
while (*fmt && grub_isdigit (*fmt)) while (*fmt && grub_isdigit (*fmt))
fmt++; fmt++;