chiark / gitweb /
test-journal-syslog: use streq_ptr since we pass in NULL
[elogind.git] / src / journal / journald-syslog.c
index dc66ba8c8fa77ed580d21785582008ab87d9b548..80eb9ff2db29cd971ff5e23d3a133df2bde2b9c6 100644 (file)
@@ -237,7 +237,7 @@ size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid)
         return e;
 }
 
-void syslog_parse_priority(char **p, int *priority, bool with_facility) {
+void syslog_parse_priority(const char **p, int *priority, bool with_facility) {
         int a = 0, b = 0, c = 0;
         int k;
 
@@ -366,7 +366,7 @@ void server_process_syslog_message(
         assert(buf);
 
         orig = buf;
-        syslog_parse_priority((char**) &buf, &priority, true);
+        syslog_parse_priority(&buf, &priority, true);
 
         if (s->forward_to_syslog)
                 forward_syslog_raw(s, priority, orig, ucred, tv);
@@ -418,7 +418,6 @@ void server_process_syslog_message(
 
 int server_open_syslog_socket(Server *s) {
         int one, r;
-        struct epoll_event ev;
 
         assert(s);
 
@@ -469,12 +468,10 @@ int server_open_syslog_socket(Server *s) {
                 return -errno;
         }
 
-        zero(ev);
-        ev.events = EPOLLIN;
-        ev.data.fd = s->syslog_fd;
-        if (epoll_ctl(s->epoll_fd, EPOLL_CTL_ADD, s->syslog_fd, &ev) < 0) {
-                log_error("Failed to add syslog server fd to epoll object: %m");
-                return -errno;
+        r = sd_event_add_io(s->event, s->syslog_fd, EPOLLIN, process_datagram, s, &s->syslog_event_source);
+        if (r < 0) {
+                log_error("Failed to add syslog server fd to event loop: %s", strerror(-r));
+                return r;
         }
 
         return 0;