diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2015-07-04 17:13:50 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2015-07-04 17:13:50 +0300 |
commit | 71cd8e3a743046573744123777061b64881bf372 (patch) | |
tree | 82522befe647f4fff186a5630cad0cad33f8ef53 /src/whoami.c | |
parent | c18578632fd3c9e513e613a86ba2b7c4ebee6c45 (diff) | |
download | coreutils-upstream.tar.gz |
Imported Upstream version 8.24upstream/8.24upstream
Diffstat (limited to 'src/whoami.c')
-rw-r--r-- | src/whoami.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/whoami.c b/src/whoami.c index 7301abb1..507910bb 100644 --- a/src/whoami.c +++ b/src/whoami.c @@ -1,6 +1,6 @@ /* whoami -- print effective userid - Copyright (C) 1989-2014 Free Software Foundation, Inc. + Copyright (C) 1989-2015 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 @@ -49,7 +49,7 @@ Same as id -un.\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); - emit_ancillary_info (); + emit_ancillary_info (PROGRAM_NAME); } exit (status); } @@ -83,12 +83,9 @@ main (int argc, char **argv) errno = 0; uid = geteuid (); pw = (uid == NO_UID && errno ? NULL : getpwuid (uid)); - if (pw) - { - puts (pw->pw_name); - exit (EXIT_SUCCESS); - } - fprintf (stderr, _("%s: cannot find name for user ID %lu\n"), - program_name, (unsigned long int) uid); - exit (EXIT_FAILURE); + if (!pw) + error (EXIT_FAILURE, errno, _("cannot find name for user ID %lu"), + (unsigned long int) uid); + puts (pw->pw_name); + return EXIT_SUCCESS; } |