chiark / gitweb /
core: OOM really shouldn't be considered a deserialization parse failure
[elogind.git] / src / core / manager.c
index 3798ab2d5774fc4f84c804ef0520bd1b7b9829b4..5fbb375cd4e96d3e08a755d2c1d887fcdd96591d 100644 (file)
@@ -262,10 +262,8 @@ static int manager_check_ask_password(Manager *m) {
                 mkdir_p_label("/run/systemd/ask-password", 0755);
 
                 m->ask_password_inotify_fd = inotify_init1(IN_NONBLOCK|IN_CLOEXEC);
-                if (m->ask_password_inotify_fd < 0) {
-                        log_error_errno(errno, "inotify_init1() failed: %m");
-                        return -errno;
-                }
+                if (m->ask_password_inotify_fd < 0)
+                        return log_error_errno(errno, "inotify_init1() failed: %m");
 
                 if (inotify_add_watch(m->ask_password_inotify_fd, "/run/systemd/ask-password", IN_CREATE|IN_DELETE|IN_MOVE) < 0) {
                         log_error_errno(errno, "Failed to add watch on /run/systemd/ask-password: %m");
@@ -334,10 +332,8 @@ static int manager_setup_time_change(Manager *m) {
          * CLOCK_REALTIME makes a jump relative to CLOCK_MONOTONIC */
 
         m->time_change_fd = timerfd_create(CLOCK_REALTIME, TFD_NONBLOCK|TFD_CLOEXEC);
-        if (m->time_change_fd < 0) {
-                log_error_errno(errno, "Failed to create timerfd: %m");
-                return -errno;
-        }
+        if (m->time_change_fd < 0)
+                return log_error_errno(errno, "Failed to create timerfd: %m");
 
         if (timerfd_settime(m->time_change_fd, TFD_TIMER_ABSTIME|TFD_TIMER_CANCEL_ON_SET, &its, NULL) < 0) {
                 log_debug_errno(errno, "Failed to set up TFD_TIMER_CANCEL_ON_SET, ignoring: %m");
@@ -544,7 +540,7 @@ int manager_new(SystemdRunningAs running_as, bool test_run, Manager **_m) {
 
         m->idle_pipe[0] = m->idle_pipe[1] = m->idle_pipe[2] = m->idle_pipe[3] = -1;
 
-        m->pin_cgroupfs_fd = m->notify_fd = m->signal_fd = m->time_change_fd = m->dev_autofs_fd = m->private_listen_fd = m->kdbus_fd = -1;
+        m->pin_cgroupfs_fd = m->notify_fd = m->signal_fd = m->time_change_fd = m->dev_autofs_fd = m->private_listen_fd = m->kdbus_fd = m->utab_inotify_fd = -1;
         m->current_job_id = 1; /* start as id #1, so that we can leave #0 around as "null-like" value */
 
         m->ask_password_inotify_fd = -1;
@@ -647,10 +643,8 @@ static int manager_setup_notify(Manager *m) {
                 m->notify_event_source = sd_event_source_unref(m->notify_event_source);
 
                 fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
-                if (fd < 0) {
-                        log_error_errno(errno, "Failed to allocate notification socket: %m");
-                        return -errno;
-                }
+                if (fd < 0)
+                        return log_error_errno(errno, "Failed to allocate notification socket: %m");
 
                 if (m->running_as == SYSTEMD_SYSTEM)
                         m->notify_socket = strdup("/run/systemd/notify");
@@ -673,16 +667,12 @@ static int manager_setup_notify(Manager *m) {
 
                 strncpy(sa.un.sun_path, m->notify_socket, sizeof(sa.un.sun_path)-1);
                 r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path));
-                if (r < 0) {
-                        log_error_errno(errno, "bind(%s) failed: %m", sa.un.sun_path);
-                        return -errno;
-                }
+                if (r < 0)
+                        return log_error_errno(errno, "bind(%s) failed: %m", sa.un.sun_path);
 
                 r = setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one));
-                if (r < 0) {
-                        log_error_errno(errno, "SO_PASSCRED failed: %m");
-                        return -errno;
-                }
+                if (r < 0)
+                        return log_error_errno(errno, "SO_PASSCRED failed: %m");
 
                 m->notify_fd = fd;
                 fd = -1;
@@ -2404,8 +2394,15 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
                                 m->kdbus_fd = fdset_remove(fds, fd);
                         }
 
-                } else if (bus_track_deserialize_item(&m->deserialized_subscribed, l) < 0)
-                        log_warning("Unknown serialization item '%s'", l);
+                } else {
+                        int k;
+
+                        k = bus_track_deserialize_item(&m->deserialized_subscribed, l);
+                        if (k < 0)
+                                log_debug_errno(k, "Failed to deserialize bus tracker object: %m");
+                        else if (k == 0)
+                                log_debug("Unknown serialization item '%s'", l);
+                }
         }
 
         for (;;) {