aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-12-01 14:39:07 +0100
committerMattias Andrée <maandree@kth.se>2016-12-01 14:39:07 +0100
commit14e8429616a782002df61e15eb003b30dbd9df29 (patch)
treebd684b252847cf89f060cf41c83f92f2d56895f6
parentFix bugs (diff)
downloadcg-tools-14e8429616a782002df61e15eb003b30dbd9df29.tar.gz
cg-tools-14e8429616a782002df61e15eb003b30dbd9df29.tar.bz2
cg-tools-14e8429616a782002df61e15eb003b30dbd9df29.tar.xz
Check that the value of -p is proper
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--src/cg-base.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cg-base.c b/src/cg-base.c
index a8c7f71..d9da32a 100644
--- a/src/cg-base.c
+++ b/src/cg-base.c
@@ -653,7 +653,13 @@ int main(int argc, char* argv[])
return 0;
}
else if (prio != NULL)
- priority = (int64_t)atoll(prio);
+ {
+ char *end;
+ errno = 0;
+ priority = (int64_t)strtoll(prio, &end, 10);
+ if (errno || *end)
+ usage();
+ }
if (!nulstrcmp(rule, "??"))
{