diff mbox

Fix scanf() formatstring for modern C version

Message ID 20151103135002.GA21871@dw
State Accepted
Delegated to: Richard Weinberger
Headers show

Commit Message

Daniel Walter Nov. 3, 2015, 1:50 p.m. UTC
mkfs.jffs2 is using an old assignment-allocation
modifier for scanf(). Add a check so this modifier
does not get confused with a float formatstring
on newer C standard (C99 onwards).

Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
---
 mkfs.jffs2.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Richard Weinberger Nov. 12, 2015, 12:37 p.m. UTC | #1
On Tue, Nov 3, 2015 at 2:50 PM, Daniel Walter <dwalter@sigma-star.at> wrote:
> mkfs.jffs2 is using an old assignment-allocation
> modifier for scanf(). Add a check so this modifier
> does not get confused with a float formatstring
> on newer C standard (C99 onwards).
>
> Signed-off-by: Daniel Walter <dwalter@sigma-star.at>

Applied and pushed!
diff mbox

Patch

diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
index f09c0b2..b83c1ee 100644
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
@@ -376,7 +376,11 @@  static struct filesystem_entry *recursive_add_host_directory(
  */
 
 #ifdef __GNUC__
+#if __STDC_VERSION__ >= 199901L
+#define SCANF_PREFIX "m"
+#else
 #define SCANF_PREFIX "a"
+#endif
 #define SCANF_STRING(s) (&s)
 #define GETCWD_SIZE 0
 #else