1
0
mirror of https://github.com/projectatomic/bubblewrap.git synced 2026-02-06 00:45:49 +01:00

main: EXIT_SUCCESS with --help

I was actually trying to do a simple test of `--help` and was
surprised that we `exit (1)` by default there.  Only do that if we
actually fail to parse options.

Pull request: #21
Approved by: alexlarsson
This commit is contained in:
Colin Walters
2016-03-15 09:17:44 -04:00
committed by Colin Walters (automation)
parent f80ec233d2
commit bf3ae2166f

View File

@@ -126,7 +126,7 @@ lock_file_new (const char *path)
static void
usage ()
usage (int ecode)
{
fprintf (stderr, "usage: %s [OPTIONS...] COMMAND [ARGS...]\n\n", argv0);
@@ -157,7 +157,7 @@ usage ()
" --symlink SRC DEST Create symlink at DEST with target SRC\n"
" --seccomp FD Load and use seccomp rules from FD\n"
);
exit (1);
exit (ecode);
}
static void
@@ -792,7 +792,7 @@ parse_args (int *argcp,
const char *arg = argv[0];
if (strcmp (arg, "--help") == 0)
usage ();
usage (EXIT_SUCCESS);
else if (strcmp (arg, "--version") == 0)
{
printf ("%s\n", PACKAGE_STRING);
@@ -1142,7 +1142,7 @@ main (int argc,
argc--;
if (argc == 0)
usage ();
usage (EXIT_FAILURE);
parse_args (&argc, &argv);
@@ -1150,7 +1150,7 @@ main (int argc,
die ("bubblewrap is not privileged, --share-user not supported");
if (argc == 0)
usage ();
usage (EXIT_FAILURE);
__debug__(("Creating root mount point\n"));