src/os/solaris/vm/attachListener_solaris.cpp

Print this page

        

@@ -666,11 +666,12 @@
   const char* probe = op->arg(0);
   if (probe == NULL || probe[0] == '\0') {
     out->print_cr("No probe specified");
     return JNI_ERR;
   } else {
-    int probe_typess = atoi(probe);
+    errno = 0;
+    int probe_typess = (int)strtol(probe, (char **)NULL, 10);
     if (errno) {
       out->print_cr("invalid probe type");
       return JNI_ERR;
     } else {
       DTrace::enable_dprobes(probe_typess);

@@ -701,11 +702,12 @@
   const char* name = op->arg(0);
   assert(name != NULL, "flag name should not be null");
   bool flag = true;
   const char* arg1;
   if ((arg1 = op->arg(1)) != NULL) {
-    flag = (atoi(arg1) != 0);
+    errno = 0;
+    flag = (strtol(arg1, (char **)NULL, 10) != 0);
     if (errno) {
       out->print_cr("flag value has to be an integer");
       return JNI_ERR;
     }
   }