summaryrefslogtreecommitdiff
path: root/src/setuidgid.c
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-02-16 14:42:43 +0000
committerIgor Pashev <pashev.igor@gmail.com>2013-02-16 14:42:43 +0000
commit974ab3dd887985e3aa347f3c6521f819296396a0 (patch)
tree802fb82c9f8ec8acd7a60fba7824c2df6f0073ad /src/setuidgid.c
parent8e7ba70eba02f88d4f3ba12e07ab9c7bdf32240a (diff)
downloadcoreutils-upstream/8.21.tar.gz
Imported Upstream version 8.21upstream/8.21
Diffstat (limited to 'src/setuidgid.c')
-rw-r--r--src/setuidgid.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/setuidgid.c b/src/setuidgid.c
index 39044ce9..ed6b65d2 100644
--- a/src/setuidgid.c
+++ b/src/setuidgid.c
@@ -1,5 +1,5 @@
/* setuidgid - run a command with the UID and GID of a specified user
- Copyright (C) 2003-2012 Free Software Foundation, Inc.
+ Copyright (C) 2003-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -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;
}