#define __LOG_FILE "/var/log/messages"
/* Path to the unix socket */
-static char lfile[BUFSIZ] = "";
+static char lfile[BUFSIZ];
static char *logFilePath = __LOG_FILE;
perror_msg_and_die("semget");
}else
perror_msg_and_die("semget");
- } else {
- sem_up(s_semid);
}
}else{
printf("Buffer already allocated just grab the semaphore?");
struct iovec iov[IOV_COUNT];
struct iovec *v = iov;
- bzero(&res, sizeof(res));
+ memset(&res, 0, sizeof(res));
snprintf(res, sizeof(res), "<%d>", pri);
v->iov_base = res ;
v->iov_len = strlen(res);
static void quit_signal(int sig)
{
- logMessage(0, "System log daemon exiting.");
+ logMessage(LOG_SYSLOG | LOG_INFO, "System log daemon exiting.");
unlink(lfile);
#ifdef BB_FEATURE_IPC_SYSLOG
ipcsyslog_cleanup();
}
}
-static const int BUFSIZE = 1023;
+/* This must be a #define, since when DODEBUG and BUFFERS_GO_IN_BSS are
+ * enabled, we otherwise get a "storage size isn't constant error. */
+#define BUFSIZE 1023
static int serveConnection (int conn)
{
RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
/* Now log it */
logMessage (pri, line);
}
+ RELEASE_BB_BUFFER (tmpbuf);
return n_read;
}
struct hostent *hostinfo;
int len = sizeof(remoteaddr);
- bzero(&remoteaddr, len);
+ memset(&remoteaddr, 0, len);
remotefd = socket(AF_INET, SOCK_DGRAM, 0);
error_msg_and_die("syslogd: cannot create socket");
}
- hostinfo = (struct hostent *) gethostbyname(RemoteHost);
-
- if (!hostinfo) {
- error_msg_and_die("syslogd: cannot resolve remote host name [%s]", RemoteHost);
- }
+ hostinfo = xgethostbyname(RemoteHost);
remoteaddr.sin_family = AF_INET;
remoteaddr.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list;
}
#endif
- logMessage (0, "syslogd started: " BB_BANNER);
+ logMessage (LOG_SYSLOG | LOG_INFO, "syslogd started: " BB_BANNER);
for (;;) {