[systemd-devel] [PATCH 1/3] systemctl: check for triggering units before calling StopUnit
Michal Sekletar
msekleta at redhat.com
Thu Aug 8 07:16:18 PDT 2013
On Thu, Aug 08, 2013 at 03:57:20PM +0200, Václav Pavlín wrote:
> Michal Sekletar píše v Čt 08. 08. 2013 v 15:19 +0200:
> > Rearranging the code in a way that we always check for triggers
> > before we issue StopUnit D-Bus call will make behavior consistent,
> > thus triggers are always checked.
> >
>
> The patch looks good, but I struggled to get through the commit message
> - it might make more sense if you split it into two sentences:
>
> Rearranging the code in a way that we always check for triggers before
> we issue StopUnit D-Bus call. This will make behavior consistent,
> because triggers are always checked.
>
I agree. Message makes more sense when we'll split it into two
sentences.
Thanks,
Michal
> > https://bugzilla.redhat.com/show_bug.cgi?id=908690
> > ---
> > src/systemctl/systemctl.c | 20 ++++++++++----------
> > 1 file changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
> > index 8ec1824..ee47841 100644
> > --- a/src/systemctl/systemctl.c
> > +++ b/src/systemctl/systemctl.c
> > @@ -1980,6 +1980,16 @@ static int start_unit(DBusConnection *bus, char **args) {
> > return log_oom();
> > }
> >
> > + /* When stopping units, warn if they can still be triggered by
> > + * another active unit (socket, path, timer) */
> > + if (!arg_quiet && streq(method, "StopUnit")) {
> > + if (one_name)
> > + check_triggering_units(bus, one_name);
> > + else
> > + STRV_FOREACH(name, args+1)
> > + check_triggering_units(bus, *name);
> > + }
> > +
> > if (one_name) {
> > ret = start_unit_one(bus, method, one_name, mode, &error, s);
> > if (ret < 0)
> > @@ -1998,16 +2008,6 @@ static int start_unit(DBusConnection *bus, char **args) {
> > r = wait_for_jobs(bus, s);
> > if (r < 0)
> > return r;
> > -
> > - /* When stopping units, warn if they can still be triggered by
> > - * another active unit (socket, path, timer) */
> > - if (!arg_quiet && streq(method, "StopUnit")) {
> > - if (one_name)
> > - check_triggering_units(bus, one_name);
> > - else
> > - STRV_FOREACH(name, args+1)
> > - check_triggering_units(bus, *name);
> > - }
> > }
> >
> > return ret;
>
>
More information about the systemd-devel
mailing list