maint: avoid exiting with magic number
authorEric Blake <ebb9@byu.net>
Thu, 29 Oct 2009 12:37:38 +0000 (06:37 -0600)
committerEric Blake <ebb9@byu.net>
Thu, 29 Oct 2009 13:31:23 +0000 (07:31 -0600)
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.

.x-sc_prohibit_magic_number_exit [new file with mode: 0644]
Makefile.am
lib/euidaccess-stat.c
src/chcon.c
src/runcon.c
src/setuidgid.c

diff --git a/.x-sc_prohibit_magic_number_exit b/.x-sc_prohibit_magic_number_exit
new file mode 100644 (file)
index 0000000..0067bc8
--- /dev/null
@@ -0,0 +1,3 @@
+configure.ac
+*.m4
+ChangeLog*
index 6175a8e..62efb7d 100644 (file)
@@ -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 \
index 3d0897b..04cb373 100644 (file)
@@ -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
index fbfdb4d..2badefb 100644 (file)
@@ -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)
index f87eada..2637373 100644 (file)
@@ -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)
index 34be515..0adac21 100644 (file)
@@ -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;
       }