X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=snprintf%2Fsnprintf.c;h=68b45776346159b8ce9f9e7e9a8f0f9fba3728ee;hb=09434f96935202d1e6cf64a74d4da4b95d06246d;hp=b0ea5d3b0373cd46e282335d303beb136e1f21f4;hpb=c9e31458c3a4813f13c9d3339071d0f924f89347;p=lttng-ust.git diff --git a/snprintf/snprintf.c b/snprintf/snprintf.c index b0ea5d3b..68b45776 100644 --- a/snprintf/snprintf.c +++ b/snprintf/snprintf.c @@ -32,26 +32,29 @@ */ #include +#include #include #include #include #include "local.h" #include "ust_snprintf.h" +#define DUMMY_LEN 1 + int ust_safe_vsnprintf(char *str, size_t n, const char *fmt, va_list ap) { int ret; - char dummy; - LFILE f; - struct __sfileext fext; + char dummy[DUMMY_LEN]; + LTTNG_UST_LFILE f; + struct __lttng_ust_sfileext fext; /* While snprintf(3) specifies size_t stdio uses an int internally */ if (n > INT_MAX) n = INT_MAX; /* Stdio internals do not deal correctly with zero length buffer */ if (n == 0) { - str = &dummy; - n = 1; + str = dummy; + n = DUMMY_LEN; } _FILEEXT_SETUP(&f, &fext); f._file = -1;