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)
}
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) {
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)
/* 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;
}
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;
}
} 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;
}