summaryrefslogtreecommitdiffstats
path: root/schedutils/chrt.c
diff options
context:
space:
mode:
authorKarel Zak2010-09-30 23:27:42 +0200
committerKarel Zak2010-09-30 23:29:14 +0200
commit24295096586c848a5eb3f8d8b73a73f03c174fc1 (patch)
tree1c071246891d5182753589a334e2ca0cd2d5bad4 /schedutils/chrt.c
parentfdisk: eliminate redundant call to open() (diff)
downloadkernel-qcow2-util-linux-24295096586c848a5eb3f8d8b73a73f03c174fc1.tar.gz
kernel-qcow2-util-linux-24295096586c848a5eb3f8d8b73a73f03c174fc1.tar.xz
kernel-qcow2-util-linux-24295096586c848a5eb3f8d8b73a73f03c174fc1.zip
taskset: proper numbers parsing
Reported-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'schedutils/chrt.c')
-rw-r--r--schedutils/chrt.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index 2d0254fa9..89b12c701 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -32,6 +32,8 @@
#include "c.h"
#include "nls.h"
+#include "schedutils.h"
+
/* the SCHED_BATCH is supported since Linux 2.6.16
* -- temporary workaround for people with old glibc headers
*/
@@ -238,9 +240,7 @@ int main(int argc, char *argv[])
break;
case 'p':
errno = 0;
- pid = strtol(argv[argc - 1], NULL, 10);
- if (errno)
- err(EXIT_FAILURE, _("failed to parse pid"));
+ pid = getnum(argv[argc - 1], _("failed to parse pid"));
break;
case 'r':
policy = SCHED_RR;
@@ -268,9 +268,7 @@ int main(int argc, char *argv[])
}
errno = 0;
- priority = strtol(argv[optind], NULL, 10);
- if (errno)
- err(EXIT_FAILURE, _("failed to parse priority"));
+ priority = getnum(argv[optind], _("failed to parse priority"));
#ifdef SCHED_RESET_ON_FORK
/* sanity check */