aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-08-09 02:50:47 +0000
committerUlrich Drepper <drepper@redhat.com>2004-08-09 02:50:47 +0000
commit807645d725f68619543836e196ae49f7b5fb5505 (patch)
treed43ac90372f8e8397965d6b389111939e637a056
parent0b755dc43f1288a7b164d85c7ab48eb71b15a65e (diff)
downloadglibc-807645d725f68619543836e196ae49f7b5fb5505.tar
glibc-807645d725f68619543836e196ae49f7b5fb5505.tar.gz
glibc-807645d725f68619543836e196ae49f7b5fb5505.tar.bz2
glibc-807645d725f68619543836e196ae49f7b5fb5505.zip
[BZ #108]
Update. * misc/syslog.c (openlog_internal): Always try both UDP and TCP. [BZ #108] Patch mainly by Bjorn Andersson <bjorn@iki.fi>.
-rw-r--r--ChangeLog3
-rw-r--r--misc/syslog.c14
2 files changed, 11 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 125b690018..e113a6dee8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2004-08-08 Ulrich Drepper <drepper@redhat.com>
+ * misc/syslog.c (openlog_internal): Always try both UDP and TCP.
+ [BZ #108] Patch mainly by Bjorn Andersson <bjorn@iki.fi>.
+
* configure.in: Also recognize i786. [BZ #106]
Patch by <pluto@pld-linux.org>.
diff --git a/misc/syslog.c b/misc/syslog.c
index c0fcdf31a4..0ba351781f 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -323,7 +323,8 @@ openlog_internal(const char *ident, int logstat, int logfac)
if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0)
LogFacility = logfac;
- while (1) {
+ int retry = 0;
+ while (retry < 2) {
if (LogFile == -1) {
SyslogAddr.sa_family = AF_UNIX;
(void)strncpy(SyslogAddr.sa_data, _PATH_LOG,
@@ -345,12 +346,13 @@ openlog_internal(const char *ident, int logstat, int logfac)
int fd = LogFile;
LogFile = -1;
(void)__close(fd);
- if (LogType == SOCK_DGRAM
- && saved_errno == EPROTOTYPE)
+ __set_errno (old_errno);
+ if (saved_errno == EPROTOTYPE)
{
- /* retry with next SOCK_STREAM: */
- LogType = SOCK_STREAM;
- __set_errno (old_errno);
+ /* retry with the other type: */
+ LogType = (LogType == SOCK_DGRAM
+ ? SOCK_STREAM : SOCK_DGRAM);
+ ++retry;
continue;
}
} else