summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-05 09:36:36 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-05 09:36:36 +0000
commitb2c14845a9e388ced210e7ca8ca5e9f86cf73025 (patch)
tree65bf046e7cfb5f76b8b5cffa13625937d50bbd01 /misc
parent57635f15d96cb65de32d3b44dc8885239b940f4e (diff)
(openlog_internal): Follow 2.1 changes to prevent errno being set.
Diffstat (limited to 'misc')
-rw-r--r--misc/syslog.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/misc/syslog.c b/misc/syslog.c
index 5521ceb9d0..91a1e0910d 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -210,7 +210,7 @@ vsyslog(pri, fmt, ap)
* is the one from the syslogd failure.
*/
if (LogStat & LOG_CONS &&
- (fd = open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0)
+ (fd = open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
{
dprintf (fd, "%s\r\n", buf + msgoff);
(void)close(fd);
@@ -251,6 +251,8 @@ openlog_internal(const char *ident, int logstat, int logfac)
}
}
if (LogFile != -1 && !connected)
+ {
+ int old_errno = errno;
if (__connect(LogFile, &SyslogAddr, sizeof(SyslogAddr))
== -1)
{
@@ -262,10 +264,12 @@ openlog_internal(const char *ident, int logstat, int logfac)
{
/* retry with next SOCK_STREAM: */
LogType = SOCK_STREAM;
+ __set_errno (old_errno);
continue;
}
} else
connected = 1;
+ }
break;
}
}