On Wed, May 04, 2022 at 04:09:41PM +0200, Theo Buehler wrote:
> On Wed, May 04, 2022 at 04:03:21PM +0200, Claudio Jeker wrote:
> > On Wed, May 04, 2022 at 03:51:02PM +0200, Theo Buehler wrote:
> > > I had output from rpki-client -f something piped into less. After an
> > > hour rpki-client couldn't take it any longer and decided to move on to
> > > a better place. It also left a residue via syslog on its way out. I
> > > don't think it should do that in file mode or offline mode:
> > > 
> > > Index: main.c
> > > ===================================================================
> > > RCS file: /cvs/src/usr.sbin/rpki-client/main.c,v
> > > retrieving revision 1.201
> > > diff -u -p -r1.201 main.c
> > > --- main.c        4 May 2022 13:07:35 -0000       1.201
> > > +++ main.c        4 May 2022 13:46:13 -0000
> > > @@ -689,7 +689,7 @@ process_start(const char *title, int *fd
> > >           /* change working directory to the cache directory */
> > >           if (fchdir(cachefd) == -1)
> > >                   err(1, "fchdir");
> > > -         if (timeout)
> > > +         if (!noop && timeout > 0)
> > >                   alarm(timeout);
> > >           close(pair[1]);
> > >           *fd = pair[0];
> > > @@ -923,7 +923,7 @@ main(int argc, char *argv[])
> > >           rrdppid = -1;
> > >   }
> > >  
> > > - if (timeout) {
> > > + if (!noop && timeout > 0) {
> > >           /*
> > >            * Commit suicide eventually
> > >            * cron will normally start a new one
> > > 
> > 
> > I agree that the alarm should not be armed for -f mode but I would keep it
> > for -n mode. At least I think the timeout protects also from excessive
> > work in case the cache was provided through other means.
> 
> Alright - I was going back and forth between two diffs. Let's go with
> the more cautious one, then:
> 
> Index: main.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rpki-client/main.c,v
> retrieving revision 1.201
> diff -u -p -r1.201 main.c
> --- main.c    4 May 2022 13:07:35 -0000       1.201
> +++ main.c    4 May 2022 14:04:51 -0000
> @@ -689,7 +689,7 @@ process_start(const char *title, int *fd
>               /* change working directory to the cache directory */
>               if (fchdir(cachefd) == -1)
>                       err(1, "fchdir");
> -             if (timeout)
> +             if (!filemode && timeout > 0)
>                       alarm(timeout);
>               close(pair[1]);
>               *fd = pair[0];
> @@ -923,7 +923,7 @@ main(int argc, char *argv[])
>               rrdppid = -1;
>       }
>  
> -     if (timeout) {
> +     if (!filemode && timeout > 0) {
>               /*
>                * Commit suicide eventually
>                * cron will normally start a new one
> 

OK.

-- 
:wq Claudio

Reply via email to