Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Dec 2019 14:02:35 -0800
From:      Conrad Meyer <cem@freebsd.org>
To:        Xin LI <delphij@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>,  svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r355318 - head/sbin/newfs_msdos
Message-ID:  <CAG6CVpXXURYpSoPhGQO0%2BiLGDLyPamuHvAdcBx6gVSoMUFp65g@mail.gmail.com>
In-Reply-To: <201912030703.xB373P5N043316@repo.freebsd.org>
References:  <201912030703.xB373P5N043316@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Xin Li,

Is there a reason to prefer exit() over returning from main?  I have
not surveyed the source tree, but I suspect most programs in base exit
by returning from main rather than explicit exit(3).

Thanks,
Conrad

On Mon, Dec 2, 2019 at 11:03 PM Xin LI <delphij@freebsd.org> wrote:
>
> Author: delphij
> Date: Tue Dec  3 07:03:25 2019
> New Revision: 355318
> URL: https://svnweb.freebsd.org/changeset/base/355318
>
> Log:
>   Explicitly exit() instead of return in main().
>
>   MFC after:    2 weeks
>
> Modified:
>   head/sbin/newfs_msdos/newfs_msdos.c
>
> Modified: head/sbin/newfs_msdos/newfs_msdos.c
> ==============================================================================
> --- head/sbin/newfs_msdos/newfs_msdos.c Tue Dec  3 07:01:28 2019        (r355317)
> +++ head/sbin/newfs_msdos/newfs_msdos.c Tue Dec  3 07:03:25 2019        (r355318)
> @@ -189,7 +189,7 @@ main(int argc, char *argv[])
>             err(1, NULL);
>      }
>      dtype = *argv;
> -    return !!mkfs_msdos(fname, dtype, &o);
> +    exit(!!mkfs_msdos(fname, dtype, &o));
>  }
>
>  /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpXXURYpSoPhGQO0%2BiLGDLyPamuHvAdcBx6gVSoMUFp65g>