On Sun, Sep 04, 2016 at 05:02:07PM +0200, Eric Faurot wrote:
> 
> The smtpd processes are not expected to ever leave their event loop.
> So stop pretending that the *_shutdown() functions could ever be called
> in this context, and just fatal() if event_dispatch() returns.
> 
make sense, ok giovanni@
 Cheers
  Giovanni

> Eric.
> 
> Index: ca.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/smtpd/ca.c,v
> retrieving revision 1.23
> diff -u -p -r1.23 ca.c
> --- ca.c      1 Sep 2016 10:54:25 -0000       1.23
> +++ ca.c      4 Sep 2016 14:37:31 -0000
> @@ -127,9 +127,8 @@ ca(void)
>       if (pledge("stdio", NULL) == -1)
>               err(1, "pledge");
>  
> -     if (event_dispatch() < 0)
> -             fatal("event_dispatch");
> -     ca_shutdown();
> +     event_dispatch();
> +     fatalx("exited event loop");
>  
>       return (0);
>  }
> Index: control.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/smtpd/control.c,v
> retrieving revision 1.115
> diff -u -p -r1.115 control.c
> --- control.c 4 Sep 2016 09:33:49 -0000       1.115
> +++ control.c 4 Sep 2016 14:37:31 -0000
> @@ -296,9 +296,8 @@ control(void)
>       if (pledge("stdio unix recvfd sendfd", NULL) == -1)
>               err(1, "pledge");
>  
> -     if (event_dispatch() < 0)
> -             fatal("event_dispatch");
> -     control_shutdown();
> +     event_dispatch();
> +     fatalx("exited event loop");
>  
>       return (0);
>  }
> Index: lka.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/smtpd/lka.c,v
> retrieving revision 1.195
> diff -u -p -r1.195 lka.c
> --- lka.c     3 Sep 2016 15:54:14 -0000       1.195
> +++ lka.c     4 Sep 2016 14:37:31 -0000
> @@ -448,9 +448,8 @@ lka(void)
>       if (pledge("stdio rpath inet dns getpw recvfd proc exec", NULL) == -1)
>               err(1, "pledge");
>  
> -     if (event_dispatch() < 0)
> -             fatal("event_dispatch");
> -     lka_shutdown();
> +     event_dispatch();
> +     fatalx("exited event loop");
>  
>       return (0);
>  }
> Index: pony.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/smtpd/pony.c,v
> retrieving revision 1.14
> diff -u -p -r1.14 pony.c
> --- pony.c    1 Sep 2016 10:54:25 -0000       1.14
> +++ pony.c    4 Sep 2016 14:37:31 -0000
> @@ -209,9 +209,8 @@ pony(void)
>       if (pledge("stdio inet unix recvfd sendfd", NULL) == -1)
>               err(1, "pledge");
>  
> -     if (event_dispatch() < 0)
> -             fatal("event_dispatch");
> -     pony_shutdown();
> +     event_dispatch();
> +     fatalx("exited event loop");
>  
>       return (0);
>  }
> Index: queue.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/smtpd/queue.c,v
> retrieving revision 1.180
> diff -u -p -r1.180 queue.c
> --- queue.c   1 Sep 2016 10:54:25 -0000       1.180
> +++ queue.c   4 Sep 2016 14:37:31 -0000
> @@ -720,9 +720,8 @@ queue(void)
>       if (pledge("stdio rpath wpath cpath flock recvfd sendfd", NULL) == -1)
>               err(1, "pledge");
>  
> -     if (event_dispatch() <  0)
> -             fatal("event_dispatch");
> -     queue_shutdown();
> +     event_dispatch();
> +     fatalx("exited event loop");
>  
>       return (0);
>  }
> Index: scheduler.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/smtpd/scheduler.c,v
> retrieving revision 1.53
> diff -u -p -r1.53 scheduler.c
> --- scheduler.c       1 Sep 2016 10:54:25 -0000       1.53
> +++ scheduler.c       4 Sep 2016 14:37:31 -0000
> @@ -489,9 +489,8 @@ scheduler(void)
>       if (pledge("stdio", NULL) == -1)
>               err(1, "pledge");
>  
> -     if (event_dispatch() < 0)
> -             fatal("event_dispatch");
> -     scheduler_shutdown();
> +     event_dispatch();
> +     fatalx("exited event loop");
>  
>       return (0);
>  }
> Index: smtpd.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/smtpd/smtpd.c,v
> retrieving revision 1.283
> diff -u -p -r1.283 smtpd.c
> --- smtpd.c   4 Sep 2016 09:33:49 -0000       1.283
> +++ smtpd.c   4 Sep 2016 14:37:31 -0000
> @@ -1050,8 +1050,8 @@ smtpd(void) {
>           "getpw sendfd proc exec id inet unix", NULL) == -1)
>               err(1, "pledge");
>  
> -     if (event_dispatch() < 0)
> -             fatal("smtpd: event_dispatch");
> +     event_dispatch();
> +     fatalx("exited event loop");
>  
>       return (0);
>  }
> 

Reply via email to