Handle variable argument lists correctly in reply() and lreply().
In particular, do not pass the same va_list to both vprintf() and vsyslog() without first reinitializing it. This fixes ftpd -d on amd64.
This commit is contained in:
parent
14070ec7f1
commit
4b192dc71d
@ -2380,14 +2380,17 @@ reply(int n, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
(void)printf("%d ", n);
|
||||
va_start(ap, fmt);
|
||||
(void)vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
(void)printf("\r\n");
|
||||
(void)fflush(stdout);
|
||||
if (ftpdebug) {
|
||||
syslog(LOG_DEBUG, "<--- %d ", n);
|
||||
va_start(ap, fmt);
|
||||
vsyslog(LOG_DEBUG, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2396,14 +2399,17 @@ lreply(int n, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
(void)printf("%d- ", n);
|
||||
va_start(ap, fmt);
|
||||
(void)vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
(void)printf("\r\n");
|
||||
(void)fflush(stdout);
|
||||
if (ftpdebug) {
|
||||
syslog(LOG_DEBUG, "<--- %d- ", n);
|
||||
va_start(ap, fmt);
|
||||
vsyslog(LOG_DEBUG, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user