[systemd-devel] [PATCH 7/7] logind: do not call session_jobs_reply() on CLOSING
Lennart Poettering
lennart at poettering.net
Fri Feb 7 07:52:34 PST 2014
On Thu, 06.02.14 21:37, Djalal Harouni (tixxdz at opendz.org) wrote:
Hmm, isn't this issue already caught by the "if (!s->create_message)"
check in session_send_reply()?
Thanks!
> match_job_removed() signal is triggered when queued jobs finish during
> session opening or closing.
>
> Calling session_jobs_reply() during opening is valid, but during
> session closing does not make sense.
>
> The session_send_create_reply() function which is called by
> session_jobs_reply() is able to detect if it was not called during
> open time by checking the 'session->create_message'. However, making
> session_jobs_reply() check session_is_opening() and user_is_opening()
> is more comprehensive.
> ---
> src/login/logind-dbus.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
> index 24482fd..4b71d9e 100644
> --- a/src/login/logind-dbus.c
> +++ b/src/login/logind-dbus.c
> @@ -1930,6 +1930,10 @@ static int session_jobs_reply(Session *s, const char *unit, const char *result,
> if (!s->started)
> return r;
>
> + /* Don't call me if this is not opening state */
> + if (!session_is_opening(s) && !user_is_opening(s->user))
> + return r;
> +
> if (streq(result, "done"))
> r = session_send_create_reply(s, NULL, opening);
> else {
> @@ -2010,6 +2014,7 @@ int match_job_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_b
> * still being created this will be set to true,
> * otherwise it will be false */
> active = service_job || !!session->scope_job;
> +
> session_jobs_reply(session, unit, result, active);
> }
>
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list