Reviewed by: various (mailing list feedback)
Submitted by: whistle communications move the socket from /dev to /var/run by default TRANSITIONALLY make syslog add a symlink.. I PROMISE I'll remove that as soon as I have the makefiles etc fixed as well.
This commit is contained in:
parent
64682bc28a
commit
36be1f6be9
@ -31,13 +31,14 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)syslog.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id: syslog.h,v 1.5 1996/03/28 14:35:37 scrappy Exp $
|
||||
* $Id: syslog.h,v 1.6 1996/03/28 18:29:14 scrappy Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SYSLOG_H_
|
||||
#define _SYS_SYSLOG_H_
|
||||
|
||||
#define _PATH_LOG "/dev/log"
|
||||
#define _OLD_PATH_LOG "/dev/log"
|
||||
#define _PATH_LOG "/var/run/log"
|
||||
|
||||
/*
|
||||
* priorities/facilities are encoded into a single 32-bit quantity, where the
|
||||
|
@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93
|
||||
.\" $Id: syslogd.8,v 1.3 1996/05/20 17:10:03 wollman Exp $
|
||||
.\" $Id: syslogd.8,v 1.4 1996/07/22 16:35:48 pst Exp $
|
||||
.\"
|
||||
.Dd October 12, 1995
|
||||
.Dt SYSLOGD 8
|
||||
@ -68,7 +68,7 @@ the default is 20 minutes.
|
||||
.It Fl p
|
||||
Specify the pathname of an alternate log socket;
|
||||
the default is
|
||||
.Pa /dev/log .
|
||||
.Pa /var/run/log .
|
||||
.El
|
||||
.Pp
|
||||
.Nm Syslogd
|
||||
@ -82,7 +82,7 @@ see
|
||||
reads messages from the
|
||||
.Tn UNIX
|
||||
domain socket
|
||||
.Pa /dev/log ,
|
||||
.Pa /var/run/log ,
|
||||
from an Internet domain socket specified in
|
||||
.Pa /etc/services ,
|
||||
and from the special device
|
||||
@ -113,10 +113,13 @@ The configuration file.
|
||||
.It Pa /var/run/syslog.pid
|
||||
The process id of current
|
||||
.Nm syslogd .
|
||||
.It Pa /dev/log
|
||||
.It Pa /var/run/log
|
||||
Name of the
|
||||
.Tn UNIX
|
||||
domain datagram log socket.
|
||||
.Nm syslogd
|
||||
might also create a symlink from the location of the old default
|
||||
socket, (/dev/log) so as to assist backwards compatibility.
|
||||
.It Pa /dev/klog
|
||||
The kernel log device.
|
||||
.El
|
||||
@ -136,4 +139,8 @@ an unauthenticated remote disk-filling service, and should probably be
|
||||
disabled by default. Some sort of
|
||||
.No inter- Ns Nm syslogd
|
||||
authentication mechanism ought to be worked out.
|
||||
|
||||
The log socket was moved from /dev to ease the use
|
||||
of a read-only root filesystem. This may confuse some old binaries
|
||||
and if possible, syslogd will create a symlink to help these programs,
|
||||
however if the root filesystem is already read only, and the link is not
|
||||
pre-existing, these binaries will not be able to log messages.
|
||||
|
@ -39,7 +39,7 @@ static const char copyright[] =
|
||||
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id: syslogd.c,v 1.9 1996/07/22 16:35:50 pst Exp $";
|
||||
"$Id: syslogd.c,v 1.10 1996/10/05 15:20:51 peter Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -104,11 +104,14 @@ static const char rcsid[] =
|
||||
|
||||
#define SYSLOG_NAMES
|
||||
#include <sys/syslog.h>
|
||||
|
||||
const char *LogName = _PATH_LOG;
|
||||
const char *ConfFile = _PATH_LOGCONF;
|
||||
const char *PidFile = _PATH_LOGPID;
|
||||
const char ctty[] = _PATH_CONSOLE;
|
||||
#if defined _OLD_PATH_LOG
|
||||
int alt_fifo;
|
||||
const char *OldLogName = _OLD_PATH_LOG;
|
||||
#endif
|
||||
|
||||
#define FDMASK(fd) (1 << (fd))
|
||||
|
||||
@ -240,6 +243,9 @@ main(argc, argv)
|
||||
break;
|
||||
case 'p': /* path */
|
||||
LogName = optarg;
|
||||
#if defined _OLD_PATH_LOG
|
||||
alt_fifo = 1;
|
||||
#endif
|
||||
break;
|
||||
case 'I': /* backwards compatible w/FreeBSD */
|
||||
case 's': /* no network mode */
|
||||
@ -292,6 +298,43 @@ main(argc, argv)
|
||||
} else
|
||||
created_lsock = 1;
|
||||
|
||||
#if defined(_OLD_PATH_LOG)
|
||||
#define LNKSZ 128
|
||||
/*
|
||||
* don't make a link for the old fifo name if we are just testing
|
||||
* (presumably the real syslogd might be using it)
|
||||
*/
|
||||
if (! alt_fifo ) {
|
||||
struct stat statb;
|
||||
char linkbuf[LNKSZ+1];
|
||||
|
||||
linkbuf[LNKSZ + 1] = '\0';
|
||||
if(stat(OldLogName,&statb) == 0) {
|
||||
switch(statb.st_mode & S_IFMT) {
|
||||
case S_IFLNK:
|
||||
/*
|
||||
* if it's already corrct leave it
|
||||
* (great for ro filesystems)
|
||||
*/
|
||||
if((readlink(OldLogName, linkbuf, LNKSZ) > 0)
|
||||
&& (! strcmp(OldLogName,linkbuf)))
|
||||
goto linkok;
|
||||
case S_IFIFO:
|
||||
/* if the unlink fails the symlink will too */
|
||||
unlink(OldLogName);
|
||||
}
|
||||
}
|
||||
if(symlink(LogName,OldLogName)) {
|
||||
(void) sprintf(line,
|
||||
"cannot create symlink %s, continuing.",
|
||||
OldLogName);
|
||||
logerror(line);
|
||||
dprintf("warning: cannot create symlink %s (%d)\n",
|
||||
OldLogName, errno);
|
||||
}
|
||||
}
|
||||
linkok:
|
||||
#endif
|
||||
if (!SecureMode)
|
||||
finet = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user