Fixed va args in MAVLink, tested with RC config, correct output

This commit is contained in:
Lorenz Meier 2013-05-21 09:12:54 +02:00
parent d720944efe
commit 5dfde44c56
1 changed files with 4 additions and 5 deletions

View File

@ -103,13 +103,12 @@ __EXPORT void mavlink_vasprintf(int _fd, int severity, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
struct mavlink_logmessage msg;
msg.severity = severity;
vsnprintf(msg.text, sizeof(msg.text), fmt, ap);
char text[MAVLINK_LOG_MAXLEN + 1];
vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
#ifdef __cplusplus
::ioctl(_fd, msg.severity, (unsigned long)msg.text);
::ioctl(_fd, severity, (unsigned long)&text[0]);
#else
ioctl(_fd, msg.severity, (unsigned long)msg.text);
ioctl(_fd, severity, (unsigned long)&text[0]);
#endif
}