summaryrefslogtreecommitdiff
path: root/src/nproc.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2012-09-06 10:34:00 +0100
committerPádraig Brady <P@draigBrady.com>2012-09-06 10:46:35 +0100
commita514bc402cc5632e8986d55caeb49b664b6fe9e6 (patch)
tree52d10c12101ead10508b3793c9498db4b2d0d376 /src/nproc.c
parent97b786a33d54ea6621e2cb9c48d56b7190a1eaf7 (diff)
downloadcoreutils-a514bc402cc5632e8986d55caeb49b664b6fe9e6.tar.xz
nproc: disallow non option command line parameters
* src/nproc.c (main): Error if any non option parameters. * NEWS: Mention the change in behavior.
Diffstat (limited to 'src/nproc.c')
-rw-r--r--src/nproc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nproc.c b/src/nproc.c
index a93ee536b..98a1b9aca 100644
--- a/src/nproc.c
+++ b/src/nproc.c
@@ -24,6 +24,7 @@
#include "system.h"
#include "error.h"
#include "nproc.h"
+#include "quote.h"
#include "xstrtol.h"
/* The official name of this program (e.g., no 'g' prefix). */
@@ -113,6 +114,12 @@ main (int argc, char **argv)
}
}
+ if (argc != optind)
+ {
+ error (0, 0, _("extra operand %s"), quote (argv[optind]));
+ usage (EXIT_FAILURE);
+ }
+
nproc = num_processors (mode);
if (ignore < nproc)