Always pass __func__, __FILE__ and __LINE__ in sudo_debug_printf()
and use a new flag, SUDO_DEBUG_FILENO to specify when to use it. This allows consumers of sudo_debug_printf() to log that data without having to specify it manually.
This commit is contained in:
@@ -421,10 +421,11 @@ sudo_debug_printf2(const char *func, const char *file, int lineno, int level,
|
||||
buflen = vasprintf(&buf, fmt, ap);
|
||||
va_end(ap);
|
||||
if (buflen != -1) {
|
||||
if (ISSET(level, SUDO_DEBUG_ERRNO))
|
||||
sudo_debug_write2(func, file, lineno, buf, buflen, saved_errno);
|
||||
int errcode = ISSET(level, SUDO_DEBUG_ERRNO) ? saved_errno : 0;
|
||||
if (ISSET(level, SUDO_DEBUG_LINENO))
|
||||
sudo_debug_write2(func, file, lineno, buf, buflen, errcode);
|
||||
else
|
||||
sudo_debug_write2(func, file, lineno, buf, buflen, 0);
|
||||
sudo_debug_write2(NULL, NULL, 0, buf, buflen, errcode);
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user