]> git.mxchange.org Git - simgear.git/blobdiff - simgear/nasal/lib.c
Olaf Flebbe:
[simgear.git] / simgear / nasal / lib.c
index 504a33c28bd67e180f7e5b463af1ad11fd3b5e61..a9feb00c06b8704911c0e57340f9b384e5cb4360 100644 (file)
@@ -228,13 +228,14 @@ static naRef f_die(naContext c, naRef me, int argc, naRef* args)
 // until it fits.  Returned buffer should be freed by the caller.
 char* dosprintf(char* f, ...)
 {
+    int l;
     char* buf;
     va_list va;
     int len = 16;
     while(1) {
         buf = naAlloc(len);
         va_start(va, f);
-        if(vsnprintf(buf, len, f, va) < len) {
+        if((l=vsnprintf(buf, len, f, va)) < len && l!=-1) {
             va_end(va);
             return buf;
         }