summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-10 20:32:27 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-10 20:32:27 +0000
commitfe848e93865384db7457d3b01aad298a6f785be7 (patch)
tree171df1f4d46f82338f621d0f7450639c767f7046 /misc
parent8193034b1d0e3760dadb06b891a22cd4631c675a (diff)
Update.
1998-03-10 Ulrich Drepper <drepper@cygnus.com> * libio/iovdprintf.c (_IO_vdprintf): Set _IO_DELETE_DONT_CLOSE flag. * misc/syslog.c (vsyslog): Don't try to send if not connected to syslog daemon. (closelog_internal): Don't do anything if not connected.
Diffstat (limited to 'misc')
-rw-r--r--misc/syslog.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/misc/syslog.c b/misc/syslog.c
index 090926a2c5..0aaabfa170 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -201,7 +201,7 @@ vsyslog(pri, fmt, ap)
if (LogType == SOCK_STREAM)
++bufsize;
- if (__send(LogFile, buf, bufsize, 0) < 0)
+ if (!connected || __send(LogFile, buf, bufsize, 0) < 0)
{
closelog_internal (); /* attempt re-open next time */
/*
@@ -245,7 +245,7 @@ openlog_internal(const char *ident, int logstat, int logfac)
(void)strncpy(SyslogAddr.sa_data, _PATH_LOG,
sizeof(SyslogAddr.sa_data));
if (LogStat & LOG_NDELAY) {
- if ((LogFile = socket(AF_UNIX, LogType, 0))
+ if ((LogFile = __socket(AF_UNIX, LogType, 0))
== -1)
return;
(void)fcntl(LogFile, F_SETFD, 1);
@@ -292,15 +292,18 @@ openlog (const char *ident, int logstat, int logfac)
static void
sigpipe_handler (int signo)
{
- closelog_internal();
+ closelog_internal ();
}
static void
closelog_internal()
{
- (void)close(LogFile);
- LogFile = -1;
- connected = 0;
+ if (!connected)
+ return;
+
+ close (LogFile);
+ LogFile = -1;
+ connected = 0;
}
void