From: Eric Blake Date: Thu, 29 Oct 2009 12:37:38 +0000 (-0600) Subject: maint: avoid exiting with magic number X-Git-Tag: v8.1~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=17b7d09bf2320c9a8addabae7049ed5431553bd1;p=thirdparty%2Fcoreutils.git maint: avoid exiting with magic number Cope with gnulib's new sc_prohibit_magic_number_exit rule. * .x-sc_prohibit_magic_number_exit: New file, to add exemptions. * Makefile.am (syntax_check_exceptions): Distribute it. * lib/euidaccess-stat.c (main): Fix culprits. * src/chcon.c (main): Likewise. * src/runcon.c (main): Likewise. * src/setuidgid.c (main): Likewise. --- diff --git a/.x-sc_prohibit_magic_number_exit b/.x-sc_prohibit_magic_number_exit new file mode 100644 index 0000000000..0067bc8c5f --- /dev/null +++ b/.x-sc_prohibit_magic_number_exit @@ -0,0 +1,3 @@ +configure.ac +*.m4 +ChangeLog* diff --git a/Makefile.am b/Makefile.am index 6175a8eef0..62efb7df00 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,6 +47,7 @@ syntax_check_exceptions = \ .x-sc_po_check \ .x-sc_program_name \ .x-sc_prohibit_atoi_atof \ + .x-sc_prohibit_magic_number_exit \ .x-sc_prohibit_stat_st_blocks \ .x-sc_prohibit_strcmp \ .x-sc_prohibit_tab_based_indentation \ diff --git a/lib/euidaccess-stat.c b/lib/euidaccess-stat.c index 3d0897bf78..04cb373717 100644 --- a/lib/euidaccess-stat.c +++ b/lib/euidaccess-stat.c @@ -130,6 +130,6 @@ main (int argc, char **argv) ok = euidaccess_stat (&st, mode); printf ("%s: %s\n", file, ok ? "y" : "n"); - exit (0); + return 0; } #endif diff --git a/src/chcon.c b/src/chcon.c index fbfdb4d297..2badefbbd9 100644 --- a/src/chcon.c +++ b/src/chcon.c @@ -546,7 +546,7 @@ main (int argc, char **argv) if (reference_file && component_specified) { error (0, 0, _("conflicting security context specifiers given")); - usage (1); + usage (EXIT_FAILURE); } if (recurse && preserve_root) diff --git a/src/runcon.c b/src/runcon.c index f87eada6a1..2637373164 100644 --- a/src/runcon.c +++ b/src/runcon.c @@ -182,7 +182,7 @@ main (int argc, char **argv) if (optind >= argc) { error (0, 0, _("you must specify -c, -t, -u, -l, -r, or context")); - usage (1); + usage (EXIT_FAILURE); } context = argv[optind++]; } @@ -190,7 +190,7 @@ main (int argc, char **argv) if (optind >= argc) { error (0, 0, _("no command specified")); - usage (1); + usage (EXIT_FAILURE); } if (is_selinux_enabled () != 1) diff --git a/src/setuidgid.c b/src/setuidgid.c index 34be5155a3..0adac215c1 100644 --- a/src/setuidgid.c +++ b/src/setuidgid.c @@ -181,7 +181,7 @@ main (int argc, char **argv) { int n = mgetgroups (pwd->pw_name, pwd->pw_gid, &gids); if (n <= 0) - error (1, errno, _("failed to get groups for user %s"), + error (EXIT_FAILURE, errno, _("failed to get groups for user %s"), quote (pwd->pw_name)); n_gids = n; }