summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-10-29 06:37:38 -0600
committerEric Blake <ebb9@byu.net>2009-10-29 07:31:23 -0600
commit17b7d09bf2320c9a8addabae7049ed5431553bd1 (patch)
treec1db8a4278ff57c1525165c1a316030a6efe4eb1
parentf2859424cbdf23f6673fd4f3a9d7a5b197e0595e (diff)
downloadcoreutils-17b7d09bf2320c9a8addabae7049ed5431553bd1.tar.xz
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.
-rw-r--r--.x-sc_prohibit_magic_number_exit3
-rw-r--r--Makefile.am1
-rw-r--r--lib/euidaccess-stat.c2
-rw-r--r--src/chcon.c2
-rw-r--r--src/runcon.c4
-rw-r--r--src/setuidgid.c2
6 files changed, 9 insertions, 5 deletions
diff --git a/.x-sc_prohibit_magic_number_exit b/.x-sc_prohibit_magic_number_exit
new file mode 100644
index 000000000..0067bc8c5
--- /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 6175a8eef..62efb7df0 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 3d0897bf7..04cb37371 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 fbfdb4d29..2badefbbd 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 f87eada6a..263737316 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 34be5155a..0adac215c 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;
}