Skip to contentSkip to conversation

Fix scanf() formatstring for modern C version

PATCH In review Daniel Walter 2 participants 2 messages Nov 3, 2015 – Nov 12, 2015 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix scanf() formatstring for modern C version

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).

---
 mkfs.jffs2.c | 4 ++++
 1 file changed, 4 insertions(+)
mkfs.jffs2.c +4 -0
index f09c0b2..b83c1ee 100644
@@ -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
Signature · 1 line
2.6.2
#1 lore raw
Quoted 6 lines · Daniel Walter

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).

Applied and pushed!

Signature · 2 lines
Thanks,
//richard