diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-30 08:58:47 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-30 08:58:47 +0000 |
commit | 410b670ecb9d69e6d42c7a88c2b957e2ba856e8f (patch) | |
tree | 59d79a0630baaa59ba2024f82810ee501b6d39b9 | |
parent | fdaf4708c52a738a45ddff168458e0823024de62 (diff) | |
download | uClibc-alpine-410b670ecb9d69e6d42c7a88c2b957e2ba856e8f.tar.bz2 uClibc-alpine-410b670ecb9d69e6d42c7a88c2b957e2ba856e8f.tar.xz |
- shrink a little bit.
text data bss dec hex filename
1176 16 24 1216 4c0 libc/misc/syslog/syslog.o.orig
1140 16 21 1177 499 libc/misc/syslog/syslog.o
-rw-r--r-- | libc/misc/syslog/syslog.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index c5c1b9e37..d8648b879 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -109,7 +109,7 @@ __UCLIBC_MUTEX_STATIC(mylock, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP); static int LogFile = -1; /* fd for log */ -static int connected; /* have done connect */ +static smalluint connected; /* have done connect */ static int LogStat = 0; /* status bits, set by openlog() */ static const char *LogTag = "syslog"; /* string to tag the entry with */ static int LogFacility = LOG_USER; /* default facility code */ @@ -117,7 +117,7 @@ static int LogMask = 0xff; /* mask of priorities to be logged */ static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */ static void -closelog_intern(int to_default) +closelog_intern(const smalluint to_default) { __UCLIBC_MUTEX_LOCK(mylock); if (LogFile != -1) { @@ -174,18 +174,15 @@ retry: sizeof(SyslogAddr.sa_data) + strlen(SyslogAddr.sa_data)) != -1) { connected = 1; - } else if (logType == SOCK_DGRAM) { - logType = SOCK_STREAM; - if (LogFile != -1) { - close(LogFile); - LogFile = -1; - } - goto retry; } else { if (LogFile != -1) { close(LogFile); LogFile = -1; } + if (logType == SOCK_DGRAM) { + logType = SOCK_STREAM; + goto retry; + } } } @@ -206,10 +203,10 @@ vsyslog( int pri, const char *fmt, va_list ap ) time_t now; int fd, saved_errno; int rc; - char tbuf[1024]; /* syslogd is unable to handle longer messages */ - + char tbuf[1024]; /* syslogd is unable to handle longer messages */ struct sigaction action, oldaction; int sigpipe; + memset (&action, 0, sizeof (action)); action.sa_handler = sigpipe_handler; sigemptyset (&action.sa_mask); @@ -316,8 +313,7 @@ vsyslog( int pri, const char *fmt, va_list ap ) getout: __UCLIBC_MUTEX_UNLOCK(mylock); if (sigpipe == 0) - sigaction (SIGPIPE, &oldaction, - (struct sigaction *) NULL); + sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL); } libc_hidden_def(vsyslog) @@ -350,7 +346,7 @@ int setlogmask(int pmask) omask = LogMask; __UCLIBC_MUTEX_LOCK(mylock); if (pmask != 0) - LogMask = pmask; + LogMask = pmask; __UCLIBC_MUTEX_UNLOCK(mylock); return (omask); } |