--- madfuload.c.orig 2008-03-02 11:37:23.000000000 +0100 +++ madfuload.c 2008-03-02 11:40:26.000000000 +0100 @@ -17,6 +17,7 @@ #include #include #include +#include /* USB stuff -- we can't rely on all Linux headers being there */ @@ -64,6 +65,9 @@ #define DFU_GETSTATE 5 #define DFU_ABORT 6 +#define STRINGBUFLEN 256 +char stringbuf[STRINGBUFLEN]; + struct dfu_status { u_int8_t bStatus; u_int8_t bwPollTimeout[3]; @@ -101,9 +105,10 @@ static void fatal(const char *format, ...) { va_list ap; + strcpy (stringbuf, format); - va_start(ap, format); - print(LOG_ERR, format, ap); + va_start(ap, stringbuf); + print(LOG_ERR, stringbuf, ap); va_end(ap); exit(1); } @@ -111,20 +116,22 @@ static void warning(const char *format, ...) { va_list ap; + strcpy (stringbuf, format); - va_start(ap, format); - print(LOG_WARNING, format, ap); + va_start(ap, stringbuf); + print(LOG_WARNING, stringbuf, ap); va_end(ap); } static void logmsg(const char *format, ...) { va_list ap; + strcpy (stringbuf, format); if (!logging) return; - va_start(ap, format); - print(LOG_DEBUG, format, ap); + va_start(ap, stringbuf); + print(LOG_DEBUG, stringbuf, ap); va_end(ap); }