grub2/0077-Fix-failing-printf-test.patch
Peter Jones f74b50e380 Rebase to upstream, fix a pile of bugs. The usual.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-06-12 15:37:08 -04:00

71 lines
1.7 KiB
Diff

From 36cf49ba9881811dec77be5564bf001b2667220b Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 2 Jan 2013 12:48:31 +0000
Subject: [PATCH 077/482] Fix failing printf test.
* grub-core/kern/misc.c (grub_vsnprintf_real): Parse '-', '.', and
'$' in the correct order when collecting type information.
---
ChangeLog | 7 +++++++
grub-core/kern/misc.c | 17 ++++++++++-------
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 68920bf..bb263f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
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>
+
* docs/grub.texi (configfile): Explain environment variable
handling.
(source): New section.
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 95d4624..c3203a0 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -741,23 +741,26 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
if (*fmt && *fmt =='-')
fmt++;
- while (*fmt && grub_isdigit (*fmt))
- fmt++;
-
- if (*fmt && *fmt =='.')
- fmt++;
+ p = fmt;
while (*fmt && grub_isdigit (*fmt))
fmt++;
- p = fmt;
-
if (*fmt && *fmt == '$')
{
curn = grub_strtoull (p, 0, 10) - 1;
fmt++;
}
+ if (*fmt && *fmt =='-')
+ fmt++;
+
+ while (*fmt && grub_isdigit (*fmt))
+ fmt++;
+
+ if (*fmt && *fmt =='.')
+ fmt++;
+
while (*fmt && grub_isdigit (*fmt))
fmt++;
--
1.8.2.1