aboutsummaryrefslogtreecommitdiff
path: root/sysklogd
diff options
context:
space:
mode:
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)
77 77
78 /* Retry up to 5 times */ 78 /* Retry up to 5 times */
79 for (f = 0; f < 5; f++) 79 for (f = 0; f < 5; f++)
80 if ((fd = open(device, m)) >= 0) 80 if ((fd = open(device, m, 0600)) >= 0)
81 break; 81 break;
82 if (fd < 0) 82 if (fd < 0)
83 return fd; 83 return fd;
@@ -177,9 +177,6 @@ static void doSyslogd(void)
177 char *q, *p = buf; 177 char *q, *p = buf;
178 int readSize; 178 int readSize;
179 179
180 /* Remove any preexisting socket/file */
181 unlink(_PATH_LOG);
182
183 /* Set up sig handlers */ 180 /* Set up sig handlers */
184 signal(SIGINT, quit_signal); 181 signal(SIGINT, quit_signal);
185 signal(SIGTERM, quit_signal); 182 signal(SIGTERM, quit_signal);
@@ -188,8 +185,9 @@ static void doSyslogd(void)
188 signal(SIGALRM, domark); 185 signal(SIGALRM, domark);
189 alarm(MarkInterval); 186 alarm(MarkInterval);
190 187
188 /* Remove any preexisting socket/file */
189 unlink(_PATH_LOG);
191 190
192 unlink( _PATH_LOG);
193 memset(&sunx, 0, sizeof(sunx)); 191 memset(&sunx, 0, sizeof(sunx));
194 sunx.sun_family = AF_UNIX; /* Unix domain socket */ 192 sunx.sun_family = AF_UNIX; /* Unix domain socket */
195 strncpy(sunx.sun_path, _PATH_LOG, sizeof(sunx.sun_path)); 193 strncpy(sunx.sun_path, _PATH_LOG, sizeof(sunx.sun_path));
@@ -200,12 +198,17 @@ static void doSyslogd(void)
200 198
201 addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path); 199 addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path);
202 if ( (bind(fd, (struct sockaddr *) &sunx, addrLength)) || 200 if ( (bind(fd, (struct sockaddr *) &sunx, addrLength)) ||
203 (fchmod(fd, 0666) < 0) || (listen(fd, 5)) ) 201 (listen(fd, 5)) )
204 { 202 {
205 perror("Could not connect to socket " _PATH_LOG); 203 perror("Could not connect to socket " _PATH_LOG);
206 exit( FALSE); 204 exit( FALSE);
207 } 205 }
208 206
207 umask(0);
208 if (chmod(_PATH_LOG, 0666) < 0) {
209 perror("Could not set permission on " _PATH_LOG);
210 exit (FALSE);
211 }
209 212
210 logMessage(LOG_SYSLOG|LOG_INFO, "syslogd started: " 213 logMessage(LOG_SYSLOG|LOG_INFO, "syslogd started: "
211 "BusyBox v" BB_VER " (" BB_BT ")"); 214 "BusyBox v" BB_VER " (" BB_BT ")");