chiark / gitweb /
Remove src/fsck
[elogind.git] / src / fsckd / fsckd.c
index 91b8df03a80e26355a7e11cd65fcc1f1e3212d5a..6b35fc26a2f69d3eedbb6658bd78198f4bcc71fd 100644 (file)
@@ -231,9 +231,12 @@ static int manager_connect_plymouth(Manager *m) {
         union sockaddr_union sa = PLYMOUTH_SOCKET;
         int r;
 
+        if (!plymouth_running())
+                return 0;
+
         /* try to connect or reconnect if sending a message */
         if (m->plymouth_fd >= 0)
-                return 0;
+                return 1;
 
         m->plymouth_fd = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0);
         if (m->plymouth_fd < 0)
@@ -272,12 +275,15 @@ static int plymouth_send_message(int plymouth_fd, const char *message, bool upda
 }
 
 static int manager_send_plymouth_message(Manager *m, const char *message) {
-        const char *plymouth_cancel_message = NULL;
+        const char *plymouth_cancel_message = NULL, *l10n_cancel_message = NULL;
         int r;
 
         r = manager_connect_plymouth(m);
         if (r < 0)
                 return r;
+        /* 0 means that plymouth isn't running, do not send any message yet */
+        else if (r == 0)
+                return 0;
 
         if (!m->plymouth_cancel_sent) {
 
@@ -288,7 +294,8 @@ static int manager_send_plymouth_message(Manager *m, const char *message) {
 
                 m->plymouth_cancel_sent = true;
 
-                plymouth_cancel_message = strjoina("fsckd-cancel-msg:", _("Press Ctrl+C to cancel all filesystem checks in progress"));
+                l10n_cancel_message = _("Press Ctrl+C to cancel all filesystem checks in progress");
+                plymouth_cancel_message = strjoina("fsckd-cancel-msg:", l10n_cancel_message);
 
                 r = plymouth_send_message(m->plymouth_fd, plymouth_cancel_message, false);
                 if (r < 0)
@@ -348,8 +355,7 @@ static int manager_update_global_progress(Manager *m) {
                 /* try to connect to plymouth and send message */
                 r = manager_send_plymouth_message(m, fsck_message);
                 if (r < 0)
-                        log_debug("Couldn't send message to plymouth");
-
+                        return r;
         }
         return 0;
 }
@@ -378,9 +384,7 @@ static int client_progress_handler(sd_event_source *s, int fd, uint32_t revents,
                 else {
                         log_warning("Closing bad behaving fsck client connection at fd %d", client->fd);
                         client_free(client);
-                        r = manager_update_global_progress(m);
-                        if (r < 0)
-                                log_warning_errno(r, "Couldn't update global progress: %m");
+                        manager_update_global_progress(m);
                 }
                 return 0;
         }
@@ -404,9 +408,7 @@ static int client_progress_handler(sd_event_source *s, int fd, uint32_t revents,
         } else
                 log_error_errno(r, "Unknown error while trying to read fsck data: %m");
 
-        r = manager_update_global_progress(m);
-        if (r < 0)
-                log_warning_errno(r, "Couldn't update global progress: %m");
+        manager_update_global_progress(m);
 
         return 0;
 }