char *event;
if (msg) {
+ int len;
+
blobmsg_parse(&write_policy, 1, &tb, blob_data(msg), blob_len(msg));
if (tb) {
event = blobmsg_get_string(tb);
- log_add(event, strlen(event) + 1, SOURCE_SYSLOG);
+ len = strlen(event) + 1;
+ if (len > LOG_LINE_SIZE) {
+ len = LOG_LINE_SIZE;
+ event[len - 1] = 0;
+ }
+
+ log_add(event, len, SOURCE_SYSLOG);
}
}
#define LOG_DEFAULT_SOCKET "/dev/log"
#define SYSLOG_PADDING 16
-#define MAXLINE 1024
-
#define KLOG_DEFAULT_PROC "/proc/kmsg"
#define PAD(x) (x % 4) ? (((x) - (x % 4)) + 4) : (x)
static void
syslog_handle_fd(struct uloop_fd *fd, unsigned int events)
{
- static char buf[MAXLINE];
+ static char buf[LOG_LINE_SIZE];
int len;
while (1) {
char *c;
- len = recv(fd->fd, buf, MAXLINE - 1, 0);
+ len = recv(fd->fd, buf, LOG_LINE_SIZE - 1, 0);
if (len < 0) {
if (errno == EINTR)
continue;