mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Can't use the same va_list twice, from Emanuele Giaquinta.
This commit is contained in:
parent
5339b8ce3a
commit
e9ebdac3dd
@ -44,12 +44,15 @@ int
|
||||
vasprintf(char **ret, const char *fmt, va_list ap)
|
||||
{
|
||||
int n;
|
||||
va_list ap2;
|
||||
|
||||
va_copy(ap2, ap);
|
||||
|
||||
if ((n = vsnprintf(NULL, 0, fmt, ap)) < 0)
|
||||
goto error;
|
||||
|
||||
*ret = xmalloc(n + 1);
|
||||
if ((n = vsnprintf(*ret, n + 1, fmt, ap)) < 0) {
|
||||
if ((n = vsnprintf(*ret, n + 1, fmt, ap2)) < 0) {
|
||||
xfree(*ret);
|
||||
goto error;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user