From: Todd C. Miller Date: Wed, 10 Mar 2010 00:20:01 +0000 (-0500) Subject: conversation function no longer puts a newline at the end of info X-Git-Tag: SUDO_1_8_0~835 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f211213dcb51c1e14e6d17850a4508ae5d0beddf;p=sudo conversation function no longer puts a newline at the end of info or error messages. --- diff --git a/plugins/sample/sample_plugin.c b/plugins/sample/sample_plugin.c index 4c17a0061..c4204102d 100644 --- a/plugins/sample/sample_plugin.c +++ b/plugins/sample/sample_plugin.c @@ -109,8 +109,8 @@ fmt_string(const char *var, const char *val) static void sudo_log(int type, const char *fmt, ...) { - struct sudo_conv_message msg; - struct sudo_conv_reply repl; + struct sudo_conv_message msg[2]; + struct sudo_conv_reply repl[2]; va_list ap; char *str; int rc; @@ -123,10 +123,12 @@ sudo_log(int type, const char *fmt, ...) /* Call conversation function */ memset(&msg, 0, sizeof(msg)); - msg.msg_type = type; - msg.msg = str; + msg[0].msg_type = type; + msg[0].msg = str; + msg[1].msg_type = type; + msg[1].msg = "\n"; memset(&repl, 0, sizeof(repl)); - sudo_conv(1, &msg, &repl); + sudo_conv(2, msg, repl); } /* diff --git a/src/conversation.c b/src/conversation.c index f498cbdb0..93c711de9 100644 --- a/src/conversation.c +++ b/src/conversation.c @@ -78,13 +78,11 @@ sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[], break; case SUDO_CONV_INFO_MSG: if (msg->msg) - (void) puts(msg->msg); + (void) fputs(msg->msg, stdout); break; case SUDO_CONV_ERROR_MSG: - if (msg->msg) { + if (msg->msg) (void) fputs(msg->msg, stderr); - (void) fputc('\n', stderr); - } break; default: goto err;