conversation function no longer puts a newline at the end of info

or error messages.
This commit is contained in:
Todd C. Miller
2010-03-09 19:20:01 -05:00
parent c8c4d6a13b
commit f211213dcb
2 changed files with 9 additions and 9 deletions

View File

@@ -109,8 +109,8 @@ fmt_string(const char *var, const char *val)
static void static void
sudo_log(int type, const char *fmt, ...) sudo_log(int type, const char *fmt, ...)
{ {
struct sudo_conv_message msg; struct sudo_conv_message msg[2];
struct sudo_conv_reply repl; struct sudo_conv_reply repl[2];
va_list ap; va_list ap;
char *str; char *str;
int rc; int rc;
@@ -123,10 +123,12 @@ sudo_log(int type, const char *fmt, ...)
/* Call conversation function */ /* Call conversation function */
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
msg.msg_type = type; msg[0].msg_type = type;
msg.msg = str; msg[0].msg = str;
msg[1].msg_type = type;
msg[1].msg = "\n";
memset(&repl, 0, sizeof(repl)); memset(&repl, 0, sizeof(repl));
sudo_conv(1, &msg, &repl); sudo_conv(2, msg, repl);
} }
/* /*

View File

@@ -78,13 +78,11 @@ sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[],
break; break;
case SUDO_CONV_INFO_MSG: case SUDO_CONV_INFO_MSG:
if (msg->msg) if (msg->msg)
(void) puts(msg->msg); (void) fputs(msg->msg, stdout);
break; break;
case SUDO_CONV_ERROR_MSG: case SUDO_CONV_ERROR_MSG:
if (msg->msg) { if (msg->msg)
(void) fputs(msg->msg, stderr); (void) fputs(msg->msg, stderr);
(void) fputc('\n', stderr);
}
break; break;
default: default:
goto err; goto err;