[PATCH] weston-launch: Drop redundant exit()

Bryce Harrington bryce at osg.samsung.com
Fri Jul 10 00:19:29 PDT 2015


On Wed, Jul 01, 2015 at 11:52:28AM +0200, Marek Chalupa wrote:
> Reviewed-by: Marek Chalupa <mchqwerty at gmail.com>

Thanks, pushed as commit 430aee1c23a641cf3227bcde08419458ef2ea252
 
> 
> On Sat, Jun 20, 2015 at 12:47 AM, Bryce Harrington <bryce at osg.samsung.com>
> wrote:
> 
> > error(1, ...) already will exit, per man page: "If status has a nonzero
> > value, then error() calls exit(3) to terminate the program using the
> > given value as the exit status."  So exit(EXIT_FAILURE) is never
> > reached.
> >
> > The EXIT_FAILURE macro is guaranteed to be non-zero.  Typically it's
> > just 1, but on some systems (e.g. OpenVMS apparently) exit(1) means
> > success so EXIT_FAILURE there is defined to some other non-zero value.
> >
> > Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
> > ---
> >  src/weston-launch.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/src/weston-launch.c b/src/weston-launch.c
> > index f67aaaf..90a070f 100644
> > --- a/src/weston-launch.c
> > +++ b/src/weston-launch.c
> > @@ -738,10 +738,8 @@ main(int argc, char *argv[])
> >                 exit(EXIT_FAILURE);
> >
> >         wl.child = fork();
> > -       if (wl.child == -1) {
> > -               error(1, errno, "fork failed");
> > -               exit(EXIT_FAILURE);
> > -       }
> > +       if (wl.child == -1)
> > +               error(EXIT_FAILURE, errno, "fork failed");
> >
> >         if (wl.child == 0)
> >                 launch_compositor(&wl, argc - optind, argv + optind);
> > --
> > 1.9.1
> >
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> >


More information about the wayland-devel mailing list