diff options
author | Jim Meyering <meyering@redhat.com> | 2012-07-03 20:13:09 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-07-03 20:13:09 +0200 |
commit | fc895b0772c80dfcb099325788478b965bae2196 (patch) | |
tree | e5d0e6e7b911d430f9faa5f6b29dfc286de6e943 /src | |
parent | f3bd32bae2c902b9dbbe241884feaf2f0a4df7fa (diff) | |
download | coreutils-fc895b0772c80dfcb099325788478b965bae2196.tar.xz |
maint: fix minor bugs in helper program, setuidgid
* src/setuidgid.c (main): Fix two error-before-usage calls not to exit.
Exit with status SETUIDGID_FAILURE (not EXIT_FAILURE) consistently.
Diffstat (limited to 'src')
-rw-r--r-- | src/setuidgid.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/setuidgid.c b/src/setuidgid.c index 39044ce90..4dc055bb9 100644 --- a/src/setuidgid.c +++ b/src/setuidgid.c @@ -107,7 +107,7 @@ main (int argc, char **argv) { if (! (xstrtoul (gr, &ptr, 10, &tmp_ul, NULL) == LONGINT_OK && tmp_ul <= GID_T_MAX)) - error (EXIT_FAILURE, 0, _("invalid group %s"), + error (SETUIDGID_FAILURE, 0, _("invalid group %s"), quote (gr)); if (n_gids == n_gids_allocated) gids = X2NREALLOC (gids, &n_gids_allocated); @@ -159,8 +159,7 @@ main (int argc, char **argv) pwd = getpwnam (user); if (pwd == NULL) { - error (SETUIDGID_FAILURE, errno, - _("unknown user-ID: %s"), quote (user)); + error (0, errno, _("unknown user-ID: %s"), quote (user)); usage (SETUIDGID_FAILURE); } uid = pwd->pw_uid; @@ -170,7 +169,7 @@ main (int argc, char **argv) pwd = getpwuid (uid); if (pwd == NULL) { - error (SETUIDGID_FAILURE, errno, + error (0, errno, _("to use user-ID %s you need to use -g too"), quote (user)); usage (SETUIDGID_FAILURE); } @@ -181,8 +180,8 @@ main (int argc, char **argv) { int n = xgetgroups (pwd->pw_name, pwd->pw_gid, &gids); if (n <= 0) - error (EXIT_FAILURE, errno, _("failed to get groups for user %s"), - quote (pwd->pw_name)); + error (SETUIDGID_FAILURE, errno, + _("failed to get groups for user %s"), quote (pwd->pw_name)); n_gids = n; } |