From: Ulrich Drepper Date: Thu, 5 Mar 1998 09:36:36 +0000 (+0000) Subject: (openlog_internal): Follow 2.1 changes to prevent errno being set. X-Git-Tag: cvs/before-sparc-2_0_x-branch~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2c14845a9e388ced210e7ca8ca5e9f86cf73025;p=thirdparty%2Fglibc.git (openlog_internal): Follow 2.1 changes to prevent errno being set. --- diff --git a/misc/syslog.c b/misc/syslog.c index 5521ceb9d06..91a1e0910d1 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; } }