Add variants of warn/error and sudo_debug_printf that take a va_list

instead of a variable number of args.
This commit is contained in:
Todd C. Miller
2012-11-08 15:37:42 -05:00
parent 56857f7f01
commit f8660f9988
5 changed files with 139 additions and 43 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2005, 2010 Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 2004-2005, 2010-2012 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -63,6 +63,22 @@ errorx2(int eval, const char *fmt, ...)
siglongjmp(error_jmp, eval);
}
void
verror2(int eval, const char *fmt, va_list ap)
{
_warning(1, fmt, ap);
sudoers_plugin_cleanup(0);
siglongjmp(error_jmp, eval);
}
void
verrorx2(int eval, const char *fmt, va_list ap)
{
_warning(0, fmt, ap);
sudoers_plugin_cleanup(0);
siglongjmp(error_jmp, eval);
}
void
warning2(const char *fmt, ...)
{
@@ -82,6 +98,18 @@ warningx2(const char *fmt, ...)
va_end(ap);
}
void
vwarning2(const char *fmt, va_list ap)
{
_warning(1, fmt, ap);
}
void
vwarningx2(const char *fmt, va_list ap)
{
_warning(0, fmt, ap);
}
static void
_warning(int use_errno, const char *fmt, va_list ap)
{