aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-01-09 23:42:43 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-01-09 23:42:43 +0000
commitff7cb2cc884a3744d257475c3b71011eec43cbd8 (patch)
treea3051fe60a942eeb0853c47b7b80b5dfeb92dc46
parentffc35178d2ffeafb91ad91202e8ea7e518d1dfd6 (diff)
downloadbusybox-w32-ff7cb2cc884a3744d257475c3b71011eec43cbd8.tar.gz
busybox-w32-ff7cb2cc884a3744d257475c3b71011eec43cbd8.tar.bz2
busybox-w32-ff7cb2cc884a3744d257475c3b71011eec43cbd8.zip
small size reduction by Bernhard Fischer <rep.nop@aon.at>
git-svn-id: svn://busybox.net/trunk/busybox@17212 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--sysklogd/syslogd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 41d7c9656..3b511490f 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -290,9 +290,6 @@ static void log_locally(char *msg)
290 goto reopen; 290 goto reopen;
291 } 291 }
292 } else { 292 } else {
293#if ENABLE_FEATURE_ROTATE_LOGFILE
294 struct stat statf;
295#endif
296 reopen: 293 reopen:
297 logFD = device_open(logFilePath, O_WRONLY | O_CREAT 294 logFD = device_open(logFilePath, O_WRONLY | O_CREAT
298 | O_NOCTTY | O_APPEND | O_NONBLOCK); 295 | O_NOCTTY | O_APPEND | O_NONBLOCK);
@@ -307,9 +304,13 @@ static void log_locally(char *msg)
307 return; 304 return;
308 } 305 }
309#if ENABLE_FEATURE_ROTATE_LOGFILE 306#if ENABLE_FEATURE_ROTATE_LOGFILE
307 {
308 struct stat statf;
309
310 isRegular = (fstat(logFD, &statf) == 0 && (statf.st_mode & S_IFREG)); 310 isRegular = (fstat(logFD, &statf) == 0 && (statf.st_mode & S_IFREG));
311 /* bug (mostly harmless): can wrap around if file > 4gb */ 311 /* bug (mostly harmless): can wrap around if file > 4gb */
312 curFileSize = statf.st_size; 312 curFileSize = statf.st_size;
313 }
313#endif 314#endif
314 } 315 }
315 316
@@ -381,12 +382,12 @@ static void parse_fac_prio_20(int pri, char *res20)
381 * that there is no timestamp, short-cutting the test. */ 382 * that there is no timestamp, short-cutting the test. */
382static void timestamp_and_log(int pri, char *msg, int len) 383static void timestamp_and_log(int pri, char *msg, int len)
383{ 384{
384 time_t now;
385 char *timestamp; 385 char *timestamp;
386 386
387 if (len < 16 || msg[3] != ' ' || msg[6] != ' ' 387 if (len < 16 || msg[3] != ' ' || msg[6] != ' '
388 || msg[9] != ':' || msg[12] != ':' || msg[15] != ' ' 388 || msg[9] != ':' || msg[12] != ':' || msg[15] != ' '
389 ) { 389 ) {
390 time_t now;
390 time(&now); 391 time(&now);
391 timestamp = ctime(&now) + 4; 392 timestamp = ctime(&now) + 4;
392 } else { 393 } else {
@@ -494,9 +495,7 @@ static void do_syslogd(void)
494 strncpy(sunx.sun_path, dev_log_name, sizeof(sunx.sun_path)); 495 strncpy(sunx.sun_path, dev_log_name, sizeof(sunx.sun_path));
495 sock_fd = xsocket(AF_UNIX, SOCK_DGRAM, 0); 496 sock_fd = xsocket(AF_UNIX, SOCK_DGRAM, 0);
496 addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path); 497 addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path);
497 if (bind(sock_fd, (struct sockaddr *) &sunx, addrLength) < 0) { 498 xbind(sock_fd, (struct sockaddr *) &sunx, addrLength);
498 bb_perror_msg_and_die("cannot connect to socket %s", dev_log_name);
499 }
500 499
501 if (chmod(dev_log_name, 0666) < 0) { 500 if (chmod(dev_log_name, 0666) < 0) {
502 bb_perror_msg_and_die("cannot set permission on %s", dev_log_name); 501 bb_perror_msg_and_die("cannot set permission on %s", dev_log_name);