]> granicus.if.org Git - sudo/commitdiff
Fix debug logging from the plugin when there is no error number.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 7 Mar 2013 15:06:01 +0000 (10:06 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 7 Mar 2013 15:06:01 +0000 (10:06 -0500)
This was broken in the big debugging reorg for 1.8.7.

common/sudo_debug.c

index 3416cb3d42d5ce5dae01b2f0cb9870dac30f98ef..f5c73d2e8cf68963775082e69b75f2051809309e 100644 (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);
+       }
     }
 }