From: Jim Meyering Date: Sat, 10 May 2003 10:41:14 +0000 (+0000) Subject: Include error.h. X-Git-Tag: v5.0.1~558 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f763671c07592bba130399e71a6fd42a41276c8;p=thirdparty%2Fcoreutils.git Include error.h. --- diff --git a/src/logname.c b/src/logname.c index d86fab0e89..0a2335c0cb 100644 --- a/src/logname.c +++ b/src/logname.c @@ -1,5 +1,5 @@ /* logname -- print user's login name - Copyright (C) 1990-1997, 1999-2002 Free Software Foundation, Inc. + Copyright (C) 1990-1997, 1999-2003 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 @@ -22,6 +22,7 @@ #include "system.h" #include "closeout.h" +#include "error.h" #include "long-options.h" /* The official name of this program (e.g., no `g' prefix). */ @@ -85,8 +86,11 @@ main (int argc, char **argv) } } - if (argc - optind != 0) - usage (EXIT_FAILURE); + if (optind < argc) + { + error (0, 0, _("too many arguments")); + usage (EXIT_FAILURE); + } /* POSIX requires using getlogin (or equivalent code). */ cp = getlogin ();