632 lines
17 KiB
Plaintext
632 lines
17 KiB
Plaintext
|
--- .pkgextract
|
||
|
+++ .pkgextract 2006-02-08 17:29:50.000000000 +0100
|
||
|
@@ -0,0 +1,16 @@
|
||
|
+patch -p0 --suffix=.dgram -s < ../sysklogd-1.4.1-dgram.patch
|
||
|
+patch -p0 --suffix=.sparc -s < ../sysklogd-1.4.1-sparc.patch
|
||
|
+patch -p0 --suffix=.forw -s < ../sysklogd-1.4.1-forw.patch
|
||
|
+patch -p0 --suffix=.fileleak -s < ../sysklogd-1.4.1-fileleak.patch
|
||
|
+patch -p0 --suffix=.ipv6 -s < ../sysklogd-ipv6.diff
|
||
|
+patch -p0 --suffix=.klogd24 -s < ../sysklogd-1.4.1-klogd24.dif
|
||
|
+patch -p0 --suffix=.large -s < ../sysklogd-1.4.1-large.patch
|
||
|
+patch -p1 --suffix=.dns -s < ../sysklogd-1.4.1-dns.patch
|
||
|
+patch -p0 --suffix=.reopen -s < ../sysklogd-1.4.1-reopen.patch
|
||
|
+patch -p0 --suffix=.sobsd -s < ../sysklogd-1.4.1-no_SO_BSDCOMPAT.diff
|
||
|
+patch -p1 --suffix=.owlcr -s < ../sysklogd-1.4.1-owl-crunch_list.diff
|
||
|
+patch -p1 --suffix=.klsize -s < ../sysklogd-1.4.1-ksyslogsize.diff
|
||
|
+patch -p0 --suffix=.usock -s < ../sysklogd-1.4.1-unix_sockets.patch
|
||
|
+patch -p0 --suffix=.shprio -s < ../sysklogd-1.4.1-showpri.patch
|
||
|
+patch -p1 --suffix=.presperc -s < ../sysklogd-1.4.1-preserve_percents.patch
|
||
|
+patch -p1 --suffix=.utf8 -s < ../sysklogd-1.4.1-utf8.patch
|
||
|
--- Makefile
|
||
|
+++ Makefile 2006-02-08 17:29:50.000000000 +0100
|
||
|
@@ -1,14 +1,17 @@
|
||
|
# Makefile for syslogd and klogd daemons.
|
||
|
|
||
|
+# For newer Kernel we have 16k buffer size
|
||
|
+LOG_BUFFER_SIZE = -DLOG_BUFFER_SIZE=16384
|
||
|
+
|
||
|
CC= gcc
|
||
|
-#CFLAGS= -g -DSYSV -Wall
|
||
|
+#CFLAGS= -g -DSYSV -Wall $(LOG_BUFFER_SIZE)
|
||
|
#LDFLAGS= -g
|
||
|
-CFLAGS= $(RPM_OPT_FLAGS) -DINET6 -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce
|
||
|
-LDFLAGS= -s
|
||
|
+CFLAGS= $(RPM_OPT_FLAGS) -D_GNU_SOURCE -DINET6 -DSYSV -Wall -pipe $(LOG_BUFFER_SIZE) -funroll-loops -fpie
|
||
|
+LDFLAGS= -pie
|
||
|
|
||
|
# Look where your install program is.
|
||
|
INSTALL = /usr/bin/install
|
||
|
-BINDIR = /usr/sbin
|
||
|
+BINDIR = /sbin
|
||
|
MANDIR = /usr/man
|
||
|
|
||
|
# There is one report that under an all ELF system there may be a need to
|
||
|
@@ -25,7 +28,7 @@
|
||
|
|
||
|
# Define the following to impart start-up delay in klogd. This is
|
||
|
# useful if klogd is started simultaneously or in close-proximity to syslogd.
|
||
|
-# KLOGD_START_DELAY = -DKLOGD_DELAY=5
|
||
|
+KLOGD_START_DELAY = -DKLOGD_DELAY=5
|
||
|
|
||
|
# The following define determines whether the package adheres to the
|
||
|
# file system standard.
|
||
|
@@ -112,11 +115,12 @@
|
||
|
rm -f syslogd klogd ksym syslog_tst oops_test TAGS tsyslogd tklogd
|
||
|
|
||
|
install_exec: syslogd klogd
|
||
|
- ${INSTALL} -m 500 -s syslogd ${BINDIR}/syslogd
|
||
|
- ${INSTALL} -m 500 -s klogd ${BINDIR}/klogd
|
||
|
+ ${INSTALL} syslogd ${DESTDIR}${BINDIR}/syslogd
|
||
|
+ ${INSTALL} klogd ${DESTDIR}${BINDIR}/klogd
|
||
|
+ ${INSTALL} -m 644 sample.conf ${DESTDIR}/etc/syslog.conf
|
||
|
|
||
|
install_man:
|
||
|
- ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 sysklogd.8 ${MANDIR}/man8/sysklogd.8
|
||
|
- ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslogd.8 ${MANDIR}/man8/syslogd.8
|
||
|
- ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslog.conf.5 ${MANDIR}/man5/syslog.conf.5
|
||
|
- ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 klogd.8 ${MANDIR}/man8/klogd.8
|
||
|
+ ${INSTALL} -m 644 sysklogd.8 ${DESTDIR}${MANDIR}/man8/sysklogd.8
|
||
|
+ ${INSTALL} -m 644 syslogd.8 ${DESTDIR}${MANDIR}/man8/syslogd.8
|
||
|
+ ${INSTALL} -m 644 syslog.conf.5 ${DESTDIR}${MANDIR}/man5/syslog.conf.5
|
||
|
+ ${INSTALL} -m 644 klogd.8 ${DESTDIR}${MANDIR}/man8/klogd.8
|
||
|
--- klogd.c
|
||
|
+++ klogd.c 2006-02-08 17:38:21.000000000 +0100
|
||
|
@@ -275,15 +275,29 @@
|
||
|
#define ksyslog klogctl
|
||
|
#endif
|
||
|
|
||
|
-#define LOG_BUFFER_SIZE 4096
|
||
|
+#ifndef _PATH_KLOG
|
||
|
+# define _PATH_KLOG "/proc/kmsg"
|
||
|
+#endif
|
||
|
+
|
||
|
+#ifndef LOG_BUFFER_SIZE
|
||
|
+# define LOG_BUFFER_SIZE 4096
|
||
|
+#endif
|
||
|
#define LOG_LINE_LENGTH 1000
|
||
|
|
||
|
#ifndef TESTING
|
||
|
-#if defined(FSSTND)
|
||
|
+# if defined(FSSTND)
|
||
|
static char *PidFile = _PATH_VARRUN "klogd.pid";
|
||
|
-#else
|
||
|
+# else
|
||
|
static char *PidFile = "/etc/klogd.pid";
|
||
|
+# endif
|
||
|
#endif
|
||
|
+
|
||
|
+#if defined(__USE_FORTIFY_LEVEL)
|
||
|
+# undef syslog
|
||
|
+# undef vsyslog
|
||
|
+# undef openlog
|
||
|
+# undef closelog
|
||
|
+# undef setlogmask
|
||
|
#endif
|
||
|
|
||
|
static int kmsg,
|
||
|
@@ -295,6 +309,8 @@
|
||
|
|
||
|
static int use_syscall = 0,
|
||
|
one_shot = 0,
|
||
|
+ ring_buf = 0,
|
||
|
+ ring_buf_clear = 0,
|
||
|
symbol_lookup = 1,
|
||
|
no_fork = 0; /* don't fork - don't run in daemon mode */
|
||
|
|
||
|
@@ -868,8 +884,7 @@
|
||
|
value = strtoul(sym_start+1, (char **) 0, 16);
|
||
|
*(line-1) = '>'; /* put back delim */
|
||
|
|
||
|
- symbol = LookupSymbol(value, &sym);
|
||
|
- if ( !symbol_lookup || symbol == (char *) 0 )
|
||
|
+ if ( !symbol_lookup || (symbol = LookupSymbol(value, &sym)) == (char *) 0 )
|
||
|
{
|
||
|
parse_state = PARSING_TEXT;
|
||
|
break;
|
||
|
@@ -910,7 +925,7 @@
|
||
|
static void LogKernelLine(void)
|
||
|
|
||
|
{
|
||
|
- auto int rdcnt;
|
||
|
+ auto int rdcnt, lvl;
|
||
|
|
||
|
/*
|
||
|
* Zero-fill the log buffer. This should cure a multitude of
|
||
|
@@ -919,6 +934,11 @@
|
||
|
* messages into this fresh buffer.
|
||
|
*/
|
||
|
memset(log_buffer, '\0', log_buf_size);
|
||
|
+ lvl = 2;
|
||
|
+ if (one_shot) {
|
||
|
+ if (ring_buf) lvl = 3;
|
||
|
+ if (ring_buf_clear) lvl = 4;
|
||
|
+ }
|
||
|
if ( (rdcnt = ksyslog(2, log_buffer, log_buf_size-1)) < 0 )
|
||
|
{
|
||
|
if ( errno == EINTR )
|
||
|
@@ -1010,10 +1030,15 @@
|
||
|
*output = (char *) 0;
|
||
|
|
||
|
#ifndef TESTING
|
||
|
- chdir ("/");
|
||
|
+ if (chdir("/") < 0) {
|
||
|
+ fprintf(stderr,
|
||
|
+ "klogd: Can not change to root directory: %s\n",
|
||
|
+ strerror(errno));
|
||
|
+ exit(1);
|
||
|
+ }
|
||
|
#endif
|
||
|
/* Parse the command-line. */
|
||
|
- while ((ch = getopt(argc, argv, "c:df:iIk:nopsvx2")) != EOF)
|
||
|
+ while ((ch = getopt(argc, argv, "c:df:iIk:nopsvx2rR")) != EOF)
|
||
|
switch((char)ch)
|
||
|
{
|
||
|
case '2': /* Print lines with symbols twice. */
|
||
|
@@ -1044,6 +1069,14 @@
|
||
|
case 'o': /* One-shot mode. */
|
||
|
one_shot = 1;
|
||
|
break;
|
||
|
+ case 'r': /* One-shot mode. */
|
||
|
+ one_shot = 1;
|
||
|
+ ring_buf = 1;
|
||
|
+ break;
|
||
|
+ case 'R': /* One-shot mode. */
|
||
|
+ one_shot = 1;
|
||
|
+ ring_buf_clear = 1;
|
||
|
+ break;
|
||
|
case 'p':
|
||
|
SetParanoiaLevel(1); /* Load symbols on oops. */
|
||
|
break;
|
||
|
@@ -1164,8 +1197,11 @@
|
||
|
if ( one_shot )
|
||
|
{
|
||
|
if (symbol_lookup) {
|
||
|
- InitKsyms(symfile);
|
||
|
- InitMsyms();
|
||
|
+ /* Both functions return 1 at success and 0 otherwise */
|
||
|
+ symbol_lookup = InitKsyms(symfile);
|
||
|
+ symbol_lookup |= InitMsyms();
|
||
|
+ if (!symbol_lookup)
|
||
|
+ Syslog(LOG_WARNING, "Cannot build symbol table - disabling symbol lookups");
|
||
|
}
|
||
|
if ( (logsrc = GetKernelLogSrc()) == kernel )
|
||
|
LogKernelLine();
|
||
|
@@ -1180,8 +1216,11 @@
|
||
|
#endif
|
||
|
logsrc = GetKernelLogSrc();
|
||
|
if (symbol_lookup) {
|
||
|
- InitKsyms(symfile);
|
||
|
- InitMsyms();
|
||
|
+ /* Both functions return 1 at success and 0 otherwise */
|
||
|
+ symbol_lookup = InitKsyms(symfile);
|
||
|
+ symbol_lookup |= InitMsyms();
|
||
|
+ if (!symbol_lookup)
|
||
|
+ Syslog(LOG_WARNING, "Cannot build symbol table - disabling symbol lookups");
|
||
|
}
|
||
|
|
||
|
/* The main loop. */
|
||
|
--- pidfile.c
|
||
|
+++ pidfile.c 2006-02-08 17:29:50.000000000 +0100
|
||
|
@@ -41,11 +41,11 @@
|
||
|
int read_pid (char *pidfile)
|
||
|
{
|
||
|
FILE *f;
|
||
|
- int pid;
|
||
|
+ int pid = 0;
|
||
|
|
||
|
if (!(f=fopen(pidfile,"r")))
|
||
|
return 0;
|
||
|
- fscanf(f,"%d", &pid);
|
||
|
+ (void)fscanf(f,"%d", &pid);
|
||
|
fclose(f);
|
||
|
return pid;
|
||
|
}
|
||
|
@@ -85,7 +85,7 @@
|
||
|
{
|
||
|
FILE *f;
|
||
|
int fd;
|
||
|
- int pid;
|
||
|
+ int pid = 0;
|
||
|
|
||
|
if ( ((fd = open(pidfile, O_RDWR|O_CREAT, 0644)) == -1)
|
||
|
|| ((f = fdopen(fd, "r+")) == NULL) ) {
|
||
|
@@ -94,7 +94,7 @@
|
||
|
}
|
||
|
|
||
|
if (flock(fd, LOCK_EX|LOCK_NB) == -1) {
|
||
|
- fscanf(f, "%d", &pid);
|
||
|
+ (void)fscanf(f, "%d", &pid);
|
||
|
fclose(f);
|
||
|
printf("Can't lock, lock is held by pid %d.\n", pid);
|
||
|
return 0;
|
||
|
--- resolve.c
|
||
|
+++ resolve.c 2006-02-08 17:29:50.000000000 +0100
|
||
|
@@ -13,6 +13,7 @@
|
||
|
#include <stdlib.h>
|
||
|
#include <signal.h>
|
||
|
#include <unistd.h>
|
||
|
+#include <errno.h>
|
||
|
|
||
|
#if defined(__GLIBC__)
|
||
|
#define dprintf mydprintf
|
||
|
@@ -208,7 +209,7 @@
|
||
|
{
|
||
|
struct sockaddr_storage ss;
|
||
|
struct addrinfo hints, *res;
|
||
|
- int r;
|
||
|
+ int r, c;
|
||
|
|
||
|
memset(&hints, 0, sizeof(hints));
|
||
|
hints.ai_socktype = SOCK_DGRAM;
|
||
|
@@ -244,6 +245,20 @@
|
||
|
} else {
|
||
|
memcpy(&ss, res->ai_addr, res->ai_addrlen);
|
||
|
}
|
||
|
- write(fd, &ss, sizeof(ss));
|
||
|
- exit(0);
|
||
|
+
|
||
|
+ c = 100;
|
||
|
+ do {
|
||
|
+ if ((r = write(fd, &ss, sizeof(ss))) < 0) {
|
||
|
+ if ((errno != EAGAIN) && (errno != EINTR)) {
|
||
|
+ dprintf("failed to write: %s\n", strerror(errno));
|
||
|
+ exit(1);
|
||
|
+ }
|
||
|
+ usleep(50000);
|
||
|
+ }
|
||
|
+ } while ((r < 0) && (c-- > 0));
|
||
|
+
|
||
|
+ if (r >= 0)
|
||
|
+ exit(0);
|
||
|
+ dprintf("failed to write: %s\n", strerror(errno));
|
||
|
+ exit(1);
|
||
|
}
|
||
|
--- sample-s390.conf
|
||
|
+++ sample-s390.conf 2006-02-08 17:29:50.000000000 +0100
|
||
|
@@ -0,0 +1,60 @@
|
||
|
+# /etc/syslog.conf - Configuration file for syslogd(8)
|
||
|
+#
|
||
|
+# For info about the format of this file, see "man syslog.conf".
|
||
|
+#
|
||
|
+
|
||
|
+#
|
||
|
+#
|
||
|
+# print most on /dev/console and on the xconsole pipe
|
||
|
+#
|
||
|
+kern.*;*.warning;news.emerg;mail.alert;authpriv.none /dev/console
|
||
|
+kern.*;*.warning;news.err;mail.err;authpriv.none |/dev/xconsole
|
||
|
+*.emerg *
|
||
|
+
|
||
|
+# enable this, if you want that root is informed
|
||
|
+# immediately, e.g. of logins
|
||
|
+#*.alert root
|
||
|
+
|
||
|
+
|
||
|
+#
|
||
|
+# all email-messages in one file
|
||
|
+#
|
||
|
+mail.* -/var/log/mail
|
||
|
+mail.info -/var/log/mail.info
|
||
|
+mail.warning -/var/log/mail.warn
|
||
|
+mail.err /var/log/mail.err
|
||
|
+
|
||
|
+#
|
||
|
+# all news-messages
|
||
|
+#
|
||
|
+# these files are rotated and examined by "news.daily"
|
||
|
+news.crit -/var/log/news/news.crit
|
||
|
+news.err -/var/log/news/news.err
|
||
|
+news.notice -/var/log/news/news.notice
|
||
|
+# enable this, if you want to keep all news messages
|
||
|
+# in one file
|
||
|
+#news.* -/var/log/news.all
|
||
|
+
|
||
|
+#
|
||
|
+# Warnings in one file
|
||
|
+#
|
||
|
+*.=warning;*.=err -/var/log/warn
|
||
|
+*.crit /var/log/warn
|
||
|
+
|
||
|
+#
|
||
|
+# save the rest in one file
|
||
|
+#
|
||
|
+*.*;mail.none;news.none -/var/log/messages
|
||
|
+
|
||
|
+#
|
||
|
+# enable this, if you want to keep all messages
|
||
|
+# in one file
|
||
|
+#*.* -/var/log/allmessages
|
||
|
+
|
||
|
+#
|
||
|
+# Some foreign boot scripts require local7
|
||
|
+#
|
||
|
+local0,local1.* -/var/log/localmessages
|
||
|
+local2,local3.* -/var/log/localmessages
|
||
|
+local4,local5.* -/var/log/localmessages
|
||
|
+local6,local7.* -/var/log/localmessages
|
||
|
--- sample.conf
|
||
|
+++ sample.conf 2006-02-08 17:29:50.000000000 +0100
|
||
|
@@ -0,0 +1,60 @@
|
||
|
+# /etc/syslog.conf - Configuration file for syslogd(8)
|
||
|
+#
|
||
|
+# For info about the format of this file, see "man syslog.conf".
|
||
|
+#
|
||
|
+
|
||
|
+#
|
||
|
+#
|
||
|
+# print most on tty10 and on the xconsole pipe
|
||
|
+#
|
||
|
+kern.warning;*.err;authpriv.none /dev/tty10
|
||
|
+kern.warning;*.err;authpriv.none |/dev/xconsole
|
||
|
+*.emerg *
|
||
|
+
|
||
|
+# enable this, if you want that root is informed
|
||
|
+# immediately, e.g. of logins
|
||
|
+#*.alert root
|
||
|
+
|
||
|
+
|
||
|
+#
|
||
|
+# all email-messages in one file
|
||
|
+#
|
||
|
+mail.* -/var/log/mail
|
||
|
+mail.info -/var/log/mail.info
|
||
|
+mail.warning -/var/log/mail.warn
|
||
|
+mail.err /var/log/mail.err
|
||
|
+
|
||
|
+#
|
||
|
+# all news-messages
|
||
|
+#
|
||
|
+# these files are rotated and examined by "news.daily"
|
||
|
+news.crit -/var/log/news/news.crit
|
||
|
+news.err -/var/log/news/news.err
|
||
|
+news.notice -/var/log/news/news.notice
|
||
|
+# enable this, if you want to keep all news messages
|
||
|
+# in one file
|
||
|
+#news.* -/var/log/news.all
|
||
|
+
|
||
|
+#
|
||
|
+# Warnings in one file
|
||
|
+#
|
||
|
+*.=warning;*.=err -/var/log/warn
|
||
|
+*.crit /var/log/warn
|
||
|
+
|
||
|
+#
|
||
|
+# save the rest in one file
|
||
|
+#
|
||
|
+*.*;mail.none;news.none -/var/log/messages
|
||
|
+
|
||
|
+#
|
||
|
+# enable this, if you want to keep all messages
|
||
|
+# in one file
|
||
|
+#*.* -/var/log/allmessages
|
||
|
+
|
||
|
+#
|
||
|
+# Some foreign boot scripts require local7
|
||
|
+#
|
||
|
+local0,local1.* -/var/log/localmessages
|
||
|
+local2,local3.* -/var/log/localmessages
|
||
|
+local4,local5.* -/var/log/localmessages
|
||
|
+local6,local7.* -/var/log/localmessages
|
||
|
--- syslog.c
|
||
|
+++ syslog.c 2006-02-08 17:29:50.000000000 +0100
|
||
|
@@ -70,7 +70,20 @@
|
||
|
#include <paths.h>
|
||
|
#include <stdio.h>
|
||
|
|
||
|
-#define _PATH_LOGNAME "/dev/log"
|
||
|
+#ifdef _PATH_LOG
|
||
|
+# define _PATH_LOGNAME _PATH_LOG
|
||
|
+#endif
|
||
|
+#ifndef _PATH_LOGNAME
|
||
|
+# define _PATH_LOGNAME "/dev/log"
|
||
|
+#endif
|
||
|
+
|
||
|
+#if defined(__USE_FORTIFY_LEVEL)
|
||
|
+# undef syslog
|
||
|
+# undef vsyslog
|
||
|
+# undef openlog
|
||
|
+# undef closelog
|
||
|
+# undef setlogmask
|
||
|
+#endif
|
||
|
|
||
|
static int LogFile = -1; /* fd for log */
|
||
|
static int connected; /* have done connect */
|
||
|
--- syslogd.c
|
||
|
+++ syslogd.c 2006-02-08 17:29:50.000000000 +0100
|
||
|
@@ -466,6 +466,7 @@
|
||
|
#include <sys/types.h>
|
||
|
#endif
|
||
|
#include <utmp.h>
|
||
|
+#include <limits.h>
|
||
|
#include <ctype.h>
|
||
|
#include <string.h>
|
||
|
#include <setjmp.h>
|
||
|
@@ -579,7 +580,11 @@
|
||
|
# define UNAMESZ 8 /* length of a login name */
|
||
|
#endif
|
||
|
#define MAXUNAMES 20 /* maximum number of user names */
|
||
|
-#define MAXFNAME 200 /* max file pathname length */
|
||
|
+#ifdef _POSIX_PATH_MAX
|
||
|
+# define MAXFNAME _POSIX_PATH_MAX
|
||
|
+#else
|
||
|
+# define MAXFNAME 200 /* max file pathname length */
|
||
|
+#endif
|
||
|
|
||
|
#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */
|
||
|
#define TABLE_NOPRI 0 /* Value to indicate no priority in f_pmask */
|
||
|
@@ -659,8 +664,8 @@
|
||
|
* in seconds after previous message is logged. After each flush,
|
||
|
* we move to the next interval until we reach the largest.
|
||
|
*/
|
||
|
-int repeatinterval[] = { 30, 60 }; /* # of secs before flush */
|
||
|
-#define MAXREPEAT ((sizeof(repeatinterval) / sizeof(repeatinterval[0])) - 1)
|
||
|
+time_t repeatinterval[] = { 30, 60 }; /* # of secs before flush */
|
||
|
+#define MAXREPEAT ((int)((sizeof(repeatinterval) / sizeof(repeatinterval[0])) - 1))
|
||
|
#define REPEATTIME(f) ((f)->f_time + repeatinterval[(f)->f_repeatcount])
|
||
|
#define BACKOFF(f) { if (++(f)->f_repeatcount > MAXREPEAT) \
|
||
|
(f)->f_repeatcount = MAXREPEAT; \
|
||
|
@@ -771,7 +776,7 @@
|
||
|
char **crunch_list(char *list);
|
||
|
int usage(void);
|
||
|
void untty(void);
|
||
|
-void printchopped(const char *hname, char *msg, int len, int fd);
|
||
|
+void printchopped(const char *hname, char *msg, size_t len, int fd);
|
||
|
void printline(const char *hname, char *msg);
|
||
|
void printsys(char *msg);
|
||
|
void logmsg(int pri, char *msg, const char *from, int flags);
|
||
|
@@ -816,7 +821,7 @@
|
||
|
int len, num_fds;
|
||
|
#else /* __GLIBC__ */
|
||
|
#ifndef TESTING
|
||
|
- size_t len;
|
||
|
+ socklen_t len;
|
||
|
#endif
|
||
|
int num_fds;
|
||
|
#endif /* __GLIBC__ */
|
||
|
@@ -857,7 +862,12 @@
|
||
|
int maxfds;
|
||
|
|
||
|
#ifndef TESTING
|
||
|
- chdir ("/");
|
||
|
+ if (chdir("/") < 0) {
|
||
|
+ fprintf(stderr,
|
||
|
+ "syslogd: Can not change to root directory: %s\n",
|
||
|
+ strerror(errno));
|
||
|
+ exit(1);
|
||
|
+ }
|
||
|
#endif
|
||
|
for (i = 1; i < MAXFUNIX; i++) {
|
||
|
funixn[i] = "";
|
||
|
@@ -1029,13 +1039,15 @@
|
||
|
*p = tolower(*p);
|
||
|
|
||
|
(void) signal(SIGTERM, die);
|
||
|
+ (void) siginterrupt(SIGTERM,1); /* Make recvfrom() be able to receive EINTR */
|
||
|
(void) signal(SIGINT, Debug ? die : SIG_IGN);
|
||
|
(void) signal(SIGQUIT, Debug ? die : SIG_IGN);
|
||
|
(void) signal(SIGCHLD, reapchild);
|
||
|
- (void) signal(SIGALRM, domark);
|
||
|
(void) signal(SIGUSR1, Debug ? debug_switch : SIG_IGN);
|
||
|
(void) signal(SIGXFSZ, SIG_IGN);
|
||
|
+ (void) signal(SIGALRM, domark);
|
||
|
(void) alarm(TIMERINTVL);
|
||
|
+ (void) siginterrupt(SIGALRM,1); /* Make recvfrom() be able to receive EINTR */
|
||
|
|
||
|
/* Create a partial message table for all file descriptors. */
|
||
|
num_fds = getdtablesize();
|
||
|
@@ -1193,7 +1205,7 @@
|
||
|
* -Joey
|
||
|
*/
|
||
|
printchopped(from, line, \
|
||
|
- i + 2, finet);
|
||
|
+ (size_t)(i + 2), finet);
|
||
|
} else if (i < 0 && errno != EINTR) {
|
||
|
dprintf("INET socket error: %d = %s.\n", \
|
||
|
errno, strerror(errno));
|
||
|
@@ -1212,7 +1224,7 @@
|
||
|
parts[fileno(stdin)] = (char *) 0;
|
||
|
i = read(fileno(stdin), line, MAXLINE);
|
||
|
if (i > 0) {
|
||
|
- printchopped(LocalHostName, line, i+1, fileno(stdin));
|
||
|
+ printchopped(LocalHostName, line, (size_t)(i+1), fileno(stdin));
|
||
|
} else if (i < 0) {
|
||
|
if (errno != EINTR) {
|
||
|
logerror("stdin");
|
||
|
@@ -1257,8 +1269,9 @@
|
||
|
close(fd);
|
||
|
#ifndef SYSV
|
||
|
die(0);
|
||
|
-#endif
|
||
|
+#else
|
||
|
return -1;
|
||
|
+#endif
|
||
|
}
|
||
|
return fd;
|
||
|
}
|
||
|
@@ -1435,7 +1448,7 @@
|
||
|
void printchopped(hname, msg, len, fd)
|
||
|
const char *hname;
|
||
|
char *msg;
|
||
|
- int len;
|
||
|
+ size_t len;
|
||
|
int fd;
|
||
|
{
|
||
|
auto int ptlngth;
|
||
|
@@ -1535,6 +1548,8 @@
|
||
|
while ((c = *p++) && q < &line[sizeof(line) - 4]) {
|
||
|
if (c == '\n')
|
||
|
*q++ = ' ';
|
||
|
+ else if (c == '\t')
|
||
|
+ *q++ = c;
|
||
|
else if (c < 040) {
|
||
|
*q++ = '^';
|
||
|
*q++ = c ^ 0100;
|
||
|
@@ -1702,7 +1717,7 @@
|
||
|
!strcmp(from, f->f_prevhost)) {
|
||
|
(void) strncpy(f->f_lasttime, timestamp, 15);
|
||
|
f->f_prevcount++;
|
||
|
- dprintf("msg repeated %d times, %ld sec of %d.\n",
|
||
|
+ dprintf("msg repeated %d times, %ld sec of %ld.\n",
|
||
|
f->f_prevcount, now - f->f_time,
|
||
|
repeatinterval[f->f_repeatcount]);
|
||
|
/*
|
||
|
@@ -2031,13 +2046,7 @@
|
||
|
register struct filed *f;
|
||
|
struct iovec *iov;
|
||
|
{
|
||
|
- char p[6 + UNAMESZ];
|
||
|
- register int i;
|
||
|
- int ttyf, len;
|
||
|
static int reenter = 0;
|
||
|
- struct utmp ut;
|
||
|
- struct utmp *uptr;
|
||
|
- char greetings[200];
|
||
|
|
||
|
if (reenter++)
|
||
|
return;
|
||
|
@@ -2051,9 +2060,18 @@
|
||
|
* and doing notty().
|
||
|
*/
|
||
|
if (fork() == 0) {
|
||
|
+ char p[6 + UNAMESZ];
|
||
|
+ register int i;
|
||
|
+ int ttyf;
|
||
|
+ static int len = 0;
|
||
|
+ struct utmp ut;
|
||
|
+ struct utmp *uptr;
|
||
|
+ static char greetings[200];
|
||
|
+
|
||
|
(void) signal(SIGTERM, SIG_DFL);
|
||
|
(void) alarm(0);
|
||
|
(void) signal(SIGALRM, endtty);
|
||
|
+ (void) siginterrupt(SIGALRM,1); /* Make recvfrom() be able to receive EINTR */
|
||
|
#ifndef SYSV
|
||
|
(void) signal(SIGTTOU, SIG_IGN);
|
||
|
(void) sigsetmask(0);
|
||
|
@@ -2069,7 +2087,7 @@
|
||
|
/* is this slot used? */
|
||
|
if (ut.ut_name[0] == '\0')
|
||
|
continue;
|
||
|
- if (ut.ut_type == LOGIN_PROCESS)
|
||
|
+ if (ut.ut_type != USER_PROCESS)
|
||
|
continue;
|
||
|
if (!(strcmp (ut.ut_name,"LOGIN"))) /* paranoia */
|
||
|
continue;
|
||
|
@@ -2249,7 +2267,7 @@
|
||
|
for (f = Files; f; f = f->f_next) {
|
||
|
#endif
|
||
|
if (f->f_prevcount && now >= REPEATTIME(f)) {
|
||
|
- dprintf("flush %s: repeated %d times, %d sec.\n",
|
||
|
+ dprintf("flush %s: repeated %d times, %ld sec.\n",
|
||
|
TypeNames[f->f_type], f->f_prevcount,
|
||
|
repeatinterval[f->f_repeatcount]);
|
||
|
fprintlog(f, LocalHostName, 0, (char *)NULL);
|
||
|
@@ -2259,6 +2277,7 @@
|
||
|
}
|
||
|
(void) signal(SIGALRM, domark);
|
||
|
(void) alarm(TIMERINTVL);
|
||
|
+ (void) siginterrupt(SIGALRM,1); /* Make recvfrom() be able to receive EINTR */
|
||
|
}
|
||
|
|
||
|
void debug_switch()
|