skill: fix argument parsing regression

Command skill accepted earlier command name as argument.  This did
not work since commit 991b8a94f0354a128085c7411713e17282c4e04a.

Reported-By: "Anne C. Hanna" <orion@ugcs.caltech.edu>
Bug-Debian: http://bugs.debian.org/659038
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2012-02-09 22:53:29 +01:00
parent 4d8f9522a7
commit ef4a6bef5f

13
skill.c
View File

@ -594,9 +594,16 @@ static void skillsnice_parse(int argc,
argv += optind;
for (i = 0; i < argc; i++) {
ENLIST(pid, strtol_or_err(argv[0],
_("failed to parse argument")));
pid_count++;
long num;
char *end = NULL;
errno = 0;
num = strtol(argv[0], &end, 10);
if (errno == 0 && argv[0] != end && end != NULL && *end == '\0') {
ENLIST(pid, num);
pid_count++;
} else {
ENLIST(cmd, argv[0]);
}
argv++;
}