Re: [systemd-devel] [PATCH 4/5] fsckd: check if plymouth is running before attempting connection

2015-03-16 Thread Tom Gundersen
On Tue, Mar 10, 2015 at 6:00 PM, Didier Roche  wrote:
> 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?

This looks good to me. Applied (with the needed revert).

Cheers,

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


Re: [systemd-devel] [PATCH 4/5] fsckd: check if plymouth is running before attempting connection

2015-03-10 Thread Didier Roche

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 
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


Re: [systemd-devel] [PATCH 4/5] fsckd: check if plymouth is running before attempting connection

2015-03-10 Thread Lennart Poettering
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?

> 

> >From fd28f24d9eaa16737cbc8f33b8fe1a806dc291b1 Mon Sep 17 00:00:00 2001
> From: Didier Roche 
> Date: Tue, 10 Mar 2015 10:05:19 +0100
> Subject: [PATCH 4/5] fsckd: check if plymouth is running before attempting
>  connection
> 
> ---
>  src/fsckd/fsckd.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/fsckd/fsckd.c b/src/fsckd/fsckd.c
> index f73d23b..52d69cd 100644
> --- a/src/fsckd/fsckd.c
> +++ b/src/fsckd/fsckd.c
> @@ -231,6 +231,9 @@ static int manager_connect_plymouth(Manager *m) {
>  union sockaddr_union sa = PLYMOUTH_SOCKET;
>  int r;
>  
> +if (!plymouth_running())
> +return 1;
> +
>  /* try to connect or reconnect if sending a message */
>  if (m->plymouth_fd >= 0)
>  return 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



Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 4/5] fsckd: check if plymouth is running before attempting connection

2015-03-10 Thread Didier Roche


>From fd28f24d9eaa16737cbc8f33b8fe1a806dc291b1 Mon Sep 17 00:00:00 2001
From: Didier Roche 
Date: Tue, 10 Mar 2015 10:05:19 +0100
Subject: [PATCH 4/5] fsckd: check if plymouth is running before attempting
 connection

---
 src/fsckd/fsckd.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/fsckd/fsckd.c b/src/fsckd/fsckd.c
index f73d23b..52d69cd 100644
--- a/src/fsckd/fsckd.c
+++ b/src/fsckd/fsckd.c
@@ -231,6 +231,9 @@ static int manager_connect_plymouth(Manager *m) {
 union sockaddr_union sa = PLYMOUTH_SOCKET;
 int r;
 
+if (!plymouth_running())
+return 1;
+
 /* try to connect or reconnect if sending a message */
 if (m->plymouth_fd >= 0)
 return 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