aboutsummaryrefslogtreecommitdiffstats
path: root/src/su.c
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-10-23 06:59:02 -0600
committerEric Blake <ebb9@byu.net>2009-10-23 16:24:05 -0600
commitb6540b96ba6510af7b2acc6e81bd9d9583f7c96b (patch)
treee67b0b04c62f2318ab15e7628832eba1648dc34b /src/su.c
parenttests: accommodate BSD getopt (diff)
downloadcoreutils-b6540b96ba6510af7b2acc6e81bd9d9583f7c96b.tar.gz
coreutils-b6540b96ba6510af7b2acc6e81bd9d9583f7c96b.zip
chroot, env, nice, su: use EXIT_CANCELED for internal failure
* src/chroot.c (main): Use EXIT_CANCELED, not EXIT_FAILURE. * src/env.c (main): Likewise. * src/nice.c (main): Likewise. * src/su.c (change_identity, main): Likewise. * doc/coreutils.texi (chroot invocation, env invocation) (nice invocation, su invocation): Document this. * NEWS: Likewise. * tests/misc/invalid-opt (exit_status): Adjust expected results. * tests/misc/help-version (expected_failure_status): Likewise.
Diffstat (limited to 'src/su.c')
-rw-r--r--src/su.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/su.c b/src/su.c
index 25b883814..0de67c95a 100644
--- a/src/su.c
+++ b/src/su.c
@@ -286,13 +286,13 @@ change_identity (const struct passwd *pw)
#ifdef HAVE_INITGROUPS
errno = 0;
if (initgroups (pw->pw_name, pw->pw_gid) == -1)
- error (EXIT_FAILURE, errno, _("cannot set groups"));
+ error (EXIT_CANCELED, errno, _("cannot set groups"));
endgrent ();
#endif
if (setgid (pw->pw_gid))
- error (EXIT_FAILURE, errno, _("cannot set group id"));
+ error (EXIT_CANCELED, errno, _("cannot set group id"));
if (setuid (pw->pw_uid))
- error (EXIT_FAILURE, errno, _("cannot set user id"));
+ error (EXIT_CANCELED, errno, _("cannot set user id"));
}
/* Run SHELL, or DEFAULT_SHELL if SHELL is empty.
@@ -406,7 +406,7 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- initialize_exit_failure (EXIT_FAILURE);
+ initialize_exit_failure (EXIT_CANCELED);
atexit (close_stdout);
fast_startup = false;
@@ -443,7 +443,7 @@ main (int argc, char **argv)
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
- usage (EXIT_FAILURE);
+ usage (EXIT_CANCELED);
}
}
@@ -458,7 +458,7 @@ main (int argc, char **argv)
pw = getpwnam (new_user);
if (! (pw && pw->pw_name && pw->pw_name[0] && pw->pw_dir && pw->pw_dir[0]
&& pw->pw_passwd))
- error (EXIT_FAILURE, 0, _("user %s does not exist"), new_user);
+ error (EXIT_CANCELED, 0, _("user %s does not exist"), new_user);
/* Make a copy of the password information and point pw at the local
copy instead. Otherwise, some systems (e.g. GNU/Linux) would clobber
@@ -481,7 +481,7 @@ main (int argc, char **argv)
#ifdef SYSLOG_FAILURE
log_su (pw, false);
#endif
- error (EXIT_FAILURE, 0, _("incorrect password"));
+ error (EXIT_CANCELED, 0, _("incorrect password"));
}
#ifdef SYSLOG_SUCCESS
else