[systemd-devel] [PATCH 2/3] set WATCHDOG_USEC environmen variable

Michael Olbrich m.olbrich at pengutronix.de
Tue Feb 7 06:57:51 PST 2012


On Tue, Feb 07, 2012 at 03:25:32PM +0100, Lennart Poettering wrote:
> On Fri, 03.02.12 21:14, Michael Olbrich (m.olbrich at pengutronix.de) wrote:
> 
> > ---
> >  src/service.c |    6 ++++++
> >  1 files changed, 6 insertions(+), 0 deletions(-)
> > 
> > diff --git a/src/service.c b/src/service.c
> > index f030ccf..9bd3332 100644
> > --- a/src/service.c
> > +++ b/src/service.c
> > @@ -1726,6 +1726,12 @@ static int service_spawn(
> >                          goto fail;
> >                  }
> >  
> > +        if (s->watchdog_usec > 0)
> > +                if (asprintf(our_env + n_env++, "WATCHDOG_USEC=%llu", (unsigned long long) s->watchdog_usec) < 0) {
> > +                        r = -ENOMEM;
> > +                        goto fail;
> > +                }
> > +
> 
> our_env needs to be allocated larger for this. You need to increase the
> new0() line to 5 instead of the current 4 char* objects.

Not in this case I think. An earlier commit removed on env variable without
decreasing  the new0() line. with this patch we have 3 possible env
variables here: NOTIFY_SOCKET, MAINPID and WATCHDOG_USEC, so we need 4
char* objects, right?

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


More information about the systemd-devel mailing list