Le 10/03/2015 11:44, Lennart Poettering a écrit :
On Tue, 10.03.15 11:34, Didier Roche (didro...@ubuntu.com) wrote:

I think it would make more sense to return 0 when ply isn't running,
and 1 if it is, no?

Did this in the attached patch. Due to this, I needed then to return 1 even if we did not reconnect to plymouth but was already connected, which slightly break the paradigm of "return 0 if we did nothing, and 1 if the action changed something and is successful".
Is that ok?

Cheers,
Didier
>From 73ce3f737e1211a7d182553cbc55727a04a18d4c Mon Sep 17 00:00:00 2001
From: Didier Roche <didro...@ubuntu.com>
Date: Tue, 10 Mar 2015 10:05:19 +0100
Subject: [PATCH 2/2] fsckd: check if plymouth is running before attempting
 connection

---
 src/fsckd/fsckd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/fsckd/fsckd.c b/src/fsckd/fsckd.c
index f23f272..70abb07 100644
--- a/src/fsckd/fsckd.c
+++ b/src/fsckd/fsckd.c
@@ -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)
@@ -278,6 +281,9 @@ static int manager_send_plymouth_message(Manager *m, const char *message) {
         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) {
 
-- 
2.1.4

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to