src/os/solaris/vm/attachListener_solaris.cpp

Print this page
rev 6165 : imported patch atoi.diff

*** 27,36 **** --- 27,37 ---- #include "runtime/os.hpp" #include "services/attachListener.hpp" #include "services/dtraceAttacher.hpp" #include <door.h> + #include <limits.h> #include <string.h> #include <signal.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/stat.h>
*** 666,680 **** 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); ! if (errno) { out->print_cr("invalid probe type"); return JNI_ERR; } else { DTrace::enable_dprobes(probe_typess); return JNI_OK; } } } --- 667,683 ---- const char* probe = op->arg(0); if (probe == NULL || probe[0] == '\0') { out->print_cr("No probe specified"); return JNI_ERR; } else { ! char *end; ! long val = strtol(probe, &end, 10); ! if (end == probe || val < 0 || val > INT_MAX) { out->print_cr("invalid probe type"); return JNI_ERR; } else { + int probe_typess = (int) val; DTrace::enable_dprobes(probe_typess); return JNI_OK; } } }
*** 701,712 **** 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); ! if (errno) { out->print_cr("flag value has to be an integer"); return JNI_ERR; } } --- 704,716 ---- 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) { ! char *end; ! flag = (strtol(arg1, &end, 10) != 0); ! if (arg1 == end) { out->print_cr("flag value has to be an integer"); return JNI_ERR; } }