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:
Tim J. Robbins 2004-05-13 05:36:38 +00:00
parent c868ac7d12
commit 9cbb335cfd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=129170

View File

@ -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);
}
}