chiark / gitweb /
manager: introduce watch_init() initializer for watches
[elogind.git] / src / core / manager.c
index f932c79..72ce2f2 100644 (file)
@@ -1363,7 +1363,8 @@ static int process_event(Manager *m, struct epoll_event *ev) {
                 ssize_t k;
 
                 /* Some timer event, to be dispatched to the units */
-                if ((k = read(w->fd, &v, sizeof(v))) != sizeof(v)) {
+                k = read(w->fd, &v, sizeof(v));
+                if (k != sizeof(v)) {
 
                         if (k < 0 && (errno == EINTR || errno == EAGAIN))
                                 break;
@@ -2307,3 +2308,10 @@ bool manager_get_show_status(Manager *m) {
 
         return plymouth_running();
 }
+
+void watch_init(Watch *w) {
+        assert(w);
+
+        w->type = WATCH_INVALID;
+        w->fd = -1;
+}