chiark / gitweb /
fscd: fix error handling
authorLennart Poettering <lennart@poettering.net>
Mon, 9 Mar 2015 17:30:37 +0000 (18:30 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 9 Mar 2015 17:30:37 +0000 (18:30 +0100)
src/fsckd/fsckd.c

index ae56fe60fd314ff0b6e134feb3469383569a8ad2..4ff8eeaeccf584cf8f84e205e97c76fe09cb9c37 100644 (file)
@@ -173,25 +173,32 @@ static int send_message_plymouth_socket(int plymouth_fd, const char *message, bo
 }
 
 static int send_message_plymouth(Manager *m, const char *message) {
 }
 
 static int send_message_plymouth(Manager *m, const char *message) {
-        int r;
         const char *plymouth_cancel_message = NULL;
         const char *plymouth_cancel_message = NULL;
+        int r;
 
         r = connect_plymouth(m);
         if (r < 0)
                 return r;
 
         if (!m->plymouth_cancel_sent) {
 
         r = connect_plymouth(m);
         if (r < 0)
                 return r;
 
         if (!m->plymouth_cancel_sent) {
-                /* indicate to plymouth that we listen to Ctrl+C */
+
+                /* Indicate to plymouth that we listen to Ctrl+C */
                 r = loop_write(m->plymouth_fd, PLYMOUTH_REQUEST_KEY, sizeof(PLYMOUTH_REQUEST_KEY), true);
                 if (r < 0)
                 r = loop_write(m->plymouth_fd, PLYMOUTH_REQUEST_KEY, sizeof(PLYMOUTH_REQUEST_KEY), true);
                 if (r < 0)
-                        return log_warning_errno(errno, "Can't send to plymouth cancel key: %m");
+                        return log_warning_errno(r, "Can't send to plymouth cancel key: %m");
+
                 m->plymouth_cancel_sent = true;
                 m->plymouth_cancel_sent = true;
+
                 plymouth_cancel_message = strjoina("fsckd-cancel-msg:", _("Press Ctrl+C to cancel all filesystem checks in progress"));
                 plymouth_cancel_message = strjoina("fsckd-cancel-msg:", _("Press Ctrl+C to cancel all filesystem checks in progress"));
+
                 r = send_message_plymouth_socket(m->plymouth_fd, plymouth_cancel_message, false);
                 if (r < 0)
                         log_warning_errno(r, "Can't send filesystem cancel message to plymouth: %m");
                 r = send_message_plymouth_socket(m->plymouth_fd, plymouth_cancel_message, false);
                 if (r < 0)
                         log_warning_errno(r, "Can't send filesystem cancel message to plymouth: %m");
+
         } else if (m->numdevices == 0) {
         } else if (m->numdevices == 0) {
+
                 m->plymouth_cancel_sent = false;
                 m->plymouth_cancel_sent = false;
+
                 r = send_message_plymouth_socket(m->plymouth_fd, "", false);
                 if (r < 0)
                         log_warning_errno(r, "Can't clear plymouth filesystem cancel message: %m");
                 r = send_message_plymouth_socket(m->plymouth_fd, "", false);
                 if (r < 0)
                         log_warning_errno(r, "Can't clear plymouth filesystem cancel message: %m");
@@ -199,7 +206,7 @@ static int send_message_plymouth(Manager *m, const char *message) {
 
         r = send_message_plymouth_socket(m->plymouth_fd,  message, true);
         if (r < 0)
 
         r = send_message_plymouth_socket(m->plymouth_fd,  message, true);
         if (r < 0)
-                return log_warning_errno(errno, "Couldn't send \"%s\" to plymouth: %m", message);
+                return log_warning_errno(r, "Couldn't send \"%s\" to plymouth: %m", message);
 
         return 0;
 }
 
         return 0;
 }