aboutsummaryrefslogtreecommitdiff
path: root/sysklogd
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-02-07 05:29:42 +0000
committerErik Andersen <andersen@codepoet.org>2000-02-07 05:29:42 +0000
commitfac10d7c59f7db0facd5fb94de273310b9ec86e6 (patch)
treedccf8f905fc5807239883da9fca6597037d487fc /sysklogd
parent50bc101b7d6e847a9a0621ca3eb28c7117d095e5 (diff)
downloadbusybox-fac10d7c59f7db0facd5fb94de273310b9ec86e6.tar.gz
A few minor updates. ;-)
Seriously though, read the Changelog for busybox 0.42, which this is about to become... -Erik
Diffstat (limited to 'sysklogd')
-rw-r--r--sysklogd/syslogd.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 0be9ded06..29ede13db 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -77,7 +77,7 @@ static int device_open(char *device, int mode)
/* Retry up to 5 times */
for (f = 0; f < 5; f++)
- if ((fd = open(device, m)) >= 0)
+ if ((fd = open(device, m, 0600)) >= 0)
break;
if (fd < 0)
return fd;
@@ -177,9 +177,6 @@ static void doSyslogd(void)
char *q, *p = buf;
int readSize;
- /* Remove any preexisting socket/file */
- unlink(_PATH_LOG);
-
/* Set up sig handlers */
signal(SIGINT, quit_signal);
signal(SIGTERM, quit_signal);
@@ -188,8 +185,9 @@ static void doSyslogd(void)
signal(SIGALRM, domark);
alarm(MarkInterval);
+ /* Remove any preexisting socket/file */
+ unlink(_PATH_LOG);
- unlink( _PATH_LOG);
memset(&sunx, 0, sizeof(sunx));
sunx.sun_family = AF_UNIX; /* Unix domain socket */
strncpy(sunx.sun_path, _PATH_LOG, sizeof(sunx.sun_path));
@@ -200,12 +198,17 @@ static void doSyslogd(void)
addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path);
if ( (bind(fd, (struct sockaddr *) &sunx, addrLength)) ||
- (fchmod(fd, 0666) < 0) || (listen(fd, 5)) )
+ (listen(fd, 5)) )
{
perror("Could not connect to socket " _PATH_LOG);
exit( FALSE);
}
+ umask(0);
+ if (chmod(_PATH_LOG, 0666) < 0) {
+ perror("Could not set permission on " _PATH_LOG);
+ exit (FALSE);
+ }
logMessage(LOG_SYSLOG|LOG_INFO, "syslogd started: "
"BusyBox v" BB_VER " (" BB_BT ")");