* syslog.cc (vsyslog): Decrement len if trailing \n has been removed.

Add \n when writing to stderr if LOG_PERROR option is set.
This commit is contained in:
Corinna Vinschen 2005-12-31 14:16:49 +00:00
parent 1b68dd91cf
commit cceba5593d
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2005-12-31 Corinna Vinschen <corinna@vinschen.de>
* syslog.cc (vsyslog): Decrement len if trailing \n has been removed.
Add \n when writing to stderr if LOG_PERROR option is set.
2005-12-31 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/in.h: Drop including stdint.h. Move definition

View File

@ -402,12 +402,15 @@ vsyslog (int priority, const char *message, va_list ap)
char *total_msg = pass.get_message ();
int len = strlen (total_msg);
if (len != 0 && (total_msg[len - 1] == '\n'))
total_msg[len - 1] = '\0';
total_msg[--len] = '\0';
msg_strings[0] = total_msg;
if (_my_tls.locals.process_logopt & LOG_PERROR)
write (STDERR_FILENO, total_msg, len + 1);
{
write (STDERR_FILENO, total_msg, len);
write (STDERR_FILENO, "\n", 1);
}
int fd;
if ((fd = try_connect_syslogd (priority, total_msg, len + 1)) >= 0)