aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-01-09 23:42:43 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-01-09 23:42:43 +0000
commitbae7948a5af99ed3340450c811a2615f253a7bdd (patch)
treea3051fe60a942eeb0853c47b7b80b5dfeb92dc46
parentdb1edde6d878a0cdbb5a5a02032aa75e0b5f2d0f (diff)
downloadbusybox-bae7948a5af99ed3340450c811a2615f253a7bdd.tar.gz
small size reduction by Bernhard Fischer <rep.nop@aon.at>
-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)
goto reopen;
}
} else {
-#if ENABLE_FEATURE_ROTATE_LOGFILE
- struct stat statf;
-#endif
reopen:
logFD = device_open(logFilePath, O_WRONLY | O_CREAT
| O_NOCTTY | O_APPEND | O_NONBLOCK);
@@ -307,9 +304,13 @@ static void log_locally(char *msg)
return;
}
#if ENABLE_FEATURE_ROTATE_LOGFILE
+ {
+ struct stat statf;
+
isRegular = (fstat(logFD, &statf) == 0 && (statf.st_mode & S_IFREG));
/* bug (mostly harmless): can wrap around if file > 4gb */
curFileSize = statf.st_size;
+ }
#endif
}
@@ -381,12 +382,12 @@ static void parse_fac_prio_20(int pri, char *res20)
* that there is no timestamp, short-cutting the test. */
static void timestamp_and_log(int pri, char *msg, int len)
{
- time_t now;
char *timestamp;
if (len < 16 || msg[3] != ' ' || msg[6] != ' '
|| msg[9] != ':' || msg[12] != ':' || msg[15] != ' '
) {
+ time_t now;
time(&now);
timestamp = ctime(&now) + 4;
} else {
@@ -494,9 +495,7 @@ static void do_syslogd(void)
strncpy(sunx.sun_path, dev_log_name, sizeof(sunx.sun_path));
sock_fd = xsocket(AF_UNIX, SOCK_DGRAM, 0);
addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path);
- if (bind(sock_fd, (struct sockaddr *) &sunx, addrLength) < 0) {
- bb_perror_msg_and_die("cannot connect to socket %s", dev_log_name);
- }
+ xbind(sock_fd, (struct sockaddr *) &sunx, addrLength);
if (chmod(dev_log_name, 0666) < 0) {
bb_perror_msg_and_die("cannot set permission on %s", dev_log_name);