From ef4a6bef5fe6ae89aad4c182d213bd3c3a1cf9e2 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Thu, 9 Feb 2012 22:53:29 +0100 Subject: [PATCH] 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" Bug-Debian: http://bugs.debian.org/659038 Signed-off-by: Sami Kerola --- skill.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/skill.c b/skill.c index 68025424..0ea21ca4 100644 --- a/skill.c +++ b/skill.c @@ -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++; }