-/*
- * Copyright (C) 2004-2010 Andre Noll <maan@tuebingen.mpg.de>
- *
- * Licensed under the GPL v2. For licencing details see COPYING.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
n = vsnprintf(msg, size, fmt, ap);
va_end(ap);
/* If that worked, return the string. */
- if (n > -1 && n < size)
- break;
+ if (n < size)
+ return msg;
/* Else try again with more space. */
- if (n > -1) /* glibc 2.1 */
- size = n + 1; /* precisely what is needed */
- else /* glibc 2.0 */
- size *= 2; /* twice the old size */
+ size = n + 1; /* precisely what is needed */
msg = dss_realloc(msg, size);
}
- return msg;
}
/**