diff options
Diffstat (limited to 'libc/misc/syslog')
| -rw-r--r-- | libc/misc/syslog/Makefile | 50 | ||||
| -rw-r--r-- | libc/misc/syslog/syslog.c | 30 |
2 files changed, 23 insertions, 57 deletions
diff --git a/libc/misc/syslog/Makefile b/libc/misc/syslog/Makefile index 26239ab7b..4a8f4a072 100644 --- a/libc/misc/syslog/Makefile +++ b/libc/misc/syslog/Makefile @@ -1,47 +1,13 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> +# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> # -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. - -TOPDIR=../../../ -include $(TOPDIR)Rules.mak - -CSRC=syslog.c -COBJS=$(patsubst %.c,%.o, $(CSRC)) -OBJS=$(COBJS) - -ifeq ($(UCLIBC_HAS_THREADS),y) -CFLAGS += $(PTINC) -endif - -OBJ_LIST=../../obj.misc.syslog - -all: $(OBJ_LIST) - -$(OBJ_LIST): $(OBJS) - echo $(patsubst %, misc/syslog/%, $(OBJS)) > $(OBJ_LIST) - -$(COBJS): %.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - $(STRIPTOOL) -x -R .note -R .comment $*.o -clean: - $(RM) *.[oa] *~ core +top_srcdir=../../../ +top_builddir=../../../ +all: objs +include $(top_builddir)Rules.mak +include Makefile.in +include $(top_srcdir)Makerules diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index 704336006..69ff0b38b 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -112,7 +112,7 @@ closelog_intern(int to_default) { LOCK; if (LogFile != -1) { - (void) close(LogFile); + (void) __close(LogFile); } LogFile = -1; connected = 0; @@ -158,7 +158,7 @@ vsyslog( int pri, const char *fmt, va_list ap ) struct sigaction action, oldaction; int sigpipe; - memset (&action, 0, sizeof (action)); + __memset (&action, 0, sizeof (action)); action.sa_handler = sigpipe_handler; sigemptyset (&action.sa_mask); sigpipe = sigaction (SIGPIPE, &action, &oldaction); @@ -184,7 +184,7 @@ vsyslog( int pri, const char *fmt, va_list ap ) (void)time(&now); stdp = p = tbuf + sprintf(tbuf, "<%d>%.15s ", pri, ctime(&now) + 4); if (LogTag) { - if (strlen(LogTag) < sizeof(tbuf) - 64) + if (__strlen(LogTag) < sizeof(tbuf) - 64) p += sprintf(p, "%s", LogTag); else p += sprintf(p, "<BUFFER OVERRUN ATTEMPT>"); @@ -207,9 +207,9 @@ vsyslog( int pri, const char *fmt, va_list ap ) p += vsnprintf(p, end - p, fmt, ap); if (p >= end || p < head_end) { /* Returned -1 in case of error... */ static const char truncate_msg[12] = "[truncated] "; - memmove(head_end + sizeof(truncate_msg), head_end, + __memmove(head_end + sizeof(truncate_msg), head_end, end - head_end - sizeof(truncate_msg)); - memcpy(head_end, truncate_msg, sizeof(truncate_msg)); + __memcpy(head_end, truncate_msg, sizeof(truncate_msg)); if (p < head_end) { while (p < end && *p) { p++; @@ -225,14 +225,14 @@ vsyslog( int pri, const char *fmt, va_list ap ) /* Output to stderr if requested. */ if (LogStat & LOG_PERROR) { *last_chr = '\n'; - (void)write(STDERR_FILENO, stdp, last_chr - stdp + 1); + (void)__write(STDERR_FILENO, stdp, last_chr - stdp + 1); } /* Output the message to the local logger using NUL as a message delimiter. */ p = tbuf; *last_chr = 0; do { - rc = write(LogFile, p, last_chr + 1 - p); + rc = __write(LogFile, p, last_chr + 1 - p); if (rc < 0) { if ((errno==EAGAIN) || (errno==EINTR)) rc=0; @@ -253,12 +253,12 @@ vsyslog( int pri, const char *fmt, va_list ap ) */ /* should mode be `O_WRONLY | O_NOCTTY' ? -- Uli */ if (LogStat & LOG_CONS && - (fd = open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) { - p = strchr(tbuf, '>') + 1; + (fd = __open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) { + p = __strchr(tbuf, '>') + 1; last_chr[0] = '\r'; last_chr[1] = '\n'; - (void)write(fd, p, last_chr - p + 2); - (void)close(fd); + (void)__write(fd, p, last_chr - p + 2); + (void)__close(fd); } getout: @@ -285,7 +285,7 @@ openlog( const char *ident, int logstat, int logfac ) LogFacility = logfac; if (LogFile == -1) { SyslogAddr.sa_family = AF_UNIX; - (void)strncpy(SyslogAddr.sa_data, _PATH_LOG, + (void)__strncpy(SyslogAddr.sa_data, _PATH_LOG, sizeof(SyslogAddr.sa_data)); retry: if (LogStat & LOG_NDELAY) { @@ -299,19 +299,19 @@ retry: if (LogFile != -1 && !connected) { if (connect(LogFile, &SyslogAddr, sizeof(SyslogAddr) - - sizeof(SyslogAddr.sa_data) + strlen(SyslogAddr.sa_data)) != -1) + sizeof(SyslogAddr.sa_data) + __strlen(SyslogAddr.sa_data)) != -1) { connected = 1; } else if (logType == SOCK_DGRAM) { logType = SOCK_STREAM; if (LogFile != -1) { - close(LogFile); + __close(LogFile); LogFile = -1; } goto retry; } else { if (LogFile != -1) { - close(LogFile); + __close(LogFile); LogFile = -1; } } |
