summaryrefslogtreecommitdiffstats
path: root/firmware/logf.c
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2010-08-02 09:10:35 +0000
committerAmaury Pouly <pamaury@rockbox.org>2010-08-02 09:10:35 +0000
commitc0838068e374d5931a61240217dd320226675c8e (patch)
tree99b2b0627d655f3adb08a7470ad8e9d9dd18b409 /firmware/logf.c
parentf84cb98b37eb71869871b5f0b2db56b8ed8a8485 (diff)
downloadrockbox-c0838068e374d5931a61240217dd320226675c8e.tar.gz
rockbox-c0838068e374d5931a61240217dd320226675c8e.tar.bz2
rockbox-c0838068e374d5931a61240217dd320226675c8e.zip
Fix a logf bug which would trigger undefined behaviour(and probably crash) when both DEBUG, CONFIG_PLATFORM & PLATFORM_HOSTED are enable
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27663 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/logf.c')
-rw-r--r--firmware/logf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/firmware/logf.c b/firmware/logf.c
index 0136600e92..d8f036703e 100644
--- a/firmware/logf.c
+++ b/firmware/logf.c
@@ -212,6 +212,9 @@ void _logf(const char *fmt, ...)
char buf[1024];
vsnprintf(buf, sizeof buf, fmt, ap);
DEBUGF("%s\n", buf);
+ /* restart va_list otherwise the result if undefined when vuprintf is called */
+ va_end(ap);
+ va_start(ap, fmt);
#endif
vuprintf(logf_push, NULL, fmt, ap);