Fix debug logging from the plugin when there is no error number.

This was broken in the big debugging reorg for 1.8.7.
This commit is contained in:
Todd C. Miller
2013-03-07 10:06:01 -05:00
parent 9722784e1c
commit 1e0a7d5112

View File

@@ -286,7 +286,7 @@ sudo_debug_write_conv(const char *func, const char *file, int lineno,
if (str[len - 1] == '\n')
len--;
if (func != NULL && file != NULL && lineno != 0) {
if (func != NULL && file != NULL) {
if (errno_val) {
sudo_printf(SUDO_CONV_DEBUG_MSG, "%.*s: %s @ %s() %s:%d",
len, str, strerror(errno_val), func, file, lineno);
@@ -294,9 +294,13 @@ sudo_debug_write_conv(const char *func, const char *file, int lineno,
sudo_printf(SUDO_CONV_DEBUG_MSG, "%.*s @ %s() %s:%d",
len, str, func, file, lineno);
}
} else if (errno_val) {
sudo_printf(SUDO_CONV_DEBUG_MSG, "%.*s: %s",
len, str, strerror(errno_val));
} else {
if (errno_val) {
sudo_printf(SUDO_CONV_DEBUG_MSG, "%.*s: %s",
len, str, strerror(errno_val));
} else {
sudo_printf(SUDO_CONV_DEBUG_MSG, "%.*s", len, str);
}
}
}