Convert sudo_debug_enter and sudo_debug_exit into macros.
In most cases, these simply expand to a call to sudo_debug_printf2(). We need to keep the function versions around in libsudo_util for backwards compatibility.
This commit is contained in:
@@ -495,130 +495,103 @@ sudo_debug_fork_v1(void)
|
||||
return pid;
|
||||
}
|
||||
|
||||
/* Functions versions of sudo_debug_enter* for backwards compatibility. */
|
||||
void
|
||||
sudo_debug_enter_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys)
|
||||
{
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"-> %s @ %s:%d", func, file, line);
|
||||
sudo_debug_enter(func, file, line, subsys);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys)
|
||||
{
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d", func, file, line);
|
||||
sudo_debug_exit(func, file, line, subsys);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_int_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, int ret)
|
||||
{
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %d", func, file, line, ret);
|
||||
sudo_debug_exit_int(func, file, line, subsys, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_uint_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, unsigned int ret)
|
||||
{
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %u", func, file, line, ret);
|
||||
sudo_debug_exit_uint(func, file, line, subsys, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_long_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, long ret)
|
||||
{
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %ld", func, file, line, ret);
|
||||
sudo_debug_exit_long(func, file, line, subsys, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_id_t_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, id_t ret)
|
||||
{
|
||||
#if SIZEOF_ID_T == 8
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %lld", func, file, line, (long long)ret);
|
||||
#else
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %d", func, file, line, (int)ret);
|
||||
#endif
|
||||
sudo_debug_exit_id_t(func, file, line, subsys, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_size_t_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, size_t ret)
|
||||
{
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %zu", func, file, line, ret);
|
||||
sudo_debug_exit_size_t(func, file, line, subsys, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_ssize_t_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, ssize_t ret)
|
||||
{
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %zd", func, file, line, ret);
|
||||
sudo_debug_exit_ssize_t(func, file, line, subsys, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_time_t_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, time_t ret)
|
||||
{
|
||||
#if SIZEOF_TIME_T == 8
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %lld", func, file, line, (long long)ret);
|
||||
#else
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %d", func, file, line, (int)ret);
|
||||
#endif
|
||||
sudo_debug_exit_time_t(func, file, line, subsys, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_mode_t_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, mode_t ret)
|
||||
{
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %d", func, file, line, (int)ret);
|
||||
sudo_debug_exit_mode_t(func, file, line, subsys, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_bool_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, bool ret)
|
||||
{
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %s", func, file, line, ret ? "true" : "false");
|
||||
sudo_debug_exit_bool(func, file, line, subsys, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_str_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, const char *ret)
|
||||
{
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %s", func, file, line, ret ? ret : "(null)");
|
||||
sudo_debug_exit_str(func, file, line, subsys, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_str_masked_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, const char *ret)
|
||||
{
|
||||
static const char stars[] = "********************************************************************************";
|
||||
const size_t len = ret ? strlen(ret) : sizeof("(null)") - 1;
|
||||
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %.*s", func, file, line, (int)len,
|
||||
ret ? stars : "(null)");
|
||||
sudo_debug_exit_str_masked(func, file, line, subsys, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_ptr_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, const void *ret)
|
||||
{
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %p", func, file, line, ret);
|
||||
sudo_debug_exit_ptr(func, file, line, subsys, ret);
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user