summaryrefslogtreecommitdiffstats
path: root/main.cxx
diff options
context:
space:
mode:
authorSunzen Wang <sunzen@gmail.com>2009-05-19 09:11:01 +0800
committerMark Wielaard <mjw@redhat.com>2009-05-19 14:51:35 +0200
commitc897e941ca645ab1e2aa325e5feaae30cc43060e (patch)
tree173ddea2788135432b217c1f639fda41e572e322 /main.cxx
parent5d8d4509dd8112b4cf2b6aada1dca9e72bac2f44 (diff)
downloadsystemtap-steved-c897e941ca645ab1e2aa325e5feaae30cc43060e.tar.gz
systemtap-steved-c897e941ca645ab1e2aa325e5feaae30cc43060e.tar.xz
systemtap-steved-c897e941ca645ab1e2aa325e5feaae30cc43060e.zip
Enhance -x option checking to only accept valid pid
Fix: Enhance -x option checking to only accept valid pid
Diffstat (limited to 'main.cxx')
-rw-r--r--main.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/main.cxx b/main.cxx
index ec5506f5..1f4f9812 100644
--- a/main.cxx
+++ b/main.cxx
@@ -639,7 +639,12 @@ main (int argc, char * const argv [])
break;
case 'x':
- s.target_pid = atoi(optarg);
+ s.target_pid = (int) strtoul(optarg, &num_endptr, 10);
+ if (*num_endptr != '\0')
+ {
+ cerr << "Invalid target process ID number." << endl;
+ usage (s, 1);
+ }
break;
case 'D':