summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/exec_state_workload.cc
diff options
context:
space:
mode:
authorBrad Burlage <brb@google.com>2019-06-18 14:17:31 -0700
committergVisor bot <gvisor-bot@google.com>2019-06-18 14:18:47 -0700
commit2e1379867a77bfa94cc740b6d1407d3702810c73 (patch)
tree27e33b7077c11366d1b6143fae428854e3cad63a /test/syscalls/linux/exec_state_workload.cc
parentec15fb116248b549a1d6c5ca835aaa52681a9bd7 (diff)
Replace usage of deprecated strtoul/strtoull
PiperOrigin-RevId: 253864770
Diffstat (limited to 'test/syscalls/linux/exec_state_workload.cc')
-rw-r--r--test/syscalls/linux/exec_state_workload.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/syscalls/linux/exec_state_workload.cc b/test/syscalls/linux/exec_state_workload.cc
index 725c2977f..028902b14 100644
--- a/test/syscalls/linux/exec_state_workload.cc
+++ b/test/syscalls/linux/exec_state_workload.cc
@@ -19,10 +19,13 @@
#include <sys/auxv.h>
#include <sys/prctl.h>
#include <sys/time.h>
+
#include <iostream>
#include <ostream>
#include <string>
+#include "absl/strings/numbers.h"
+
// Pretty-print a sigset_t.
std::ostream& operator<<(std::ostream& out, const sigset_t& s) {
out << "{ ";
@@ -138,15 +141,14 @@ int main(int argc, char** argv) {
return 1;
}
- char* end;
- uint32_t signo = strtoul(argv[2], &end, 10);
- if (end == argv[2]) {
+ uint32_t signo;
+ if (!absl::SimpleAtoi(argv[2], &signo)) {
std::cerr << "invalid signo: " << argv[2] << std::endl;
return 1;
}
- uintptr_t handler = strtoull(argv[3], &end, 16);
- if (end == argv[3]) {
+ uintptr_t handler;
+ if (!absl::numbers_internal::safe_strtoi_base(argv[3], &handler, 16)) {
std::cerr << "invalid handler: " << std::hex << argv[3] << std::endl;
return 1;
}
@@ -160,9 +162,8 @@ int main(int argc, char** argv) {
return 1;
}
- char* end;
- uint32_t signo = strtoul(argv[2], &end, 10);
- if (end == argv[2]) {
+ uint32_t signo;
+ if (!absl::SimpleAtoi(argv[2], &signo)) {
std::cerr << "invalid signo: " << argv[2] << std::endl;
return 1;
}
@@ -176,9 +177,8 @@ int main(int argc, char** argv) {
return 1;
}
- char* end;
- uint32_t timer = strtoul(argv[2], &end, 10);
- if (end == argv[2]) {
+ uint32_t timer;
+ if (!absl::SimpleAtoi(argv[2], &timer)) {
std::cerr << "invalid signo: " << argv[2] << std::endl;
return 1;
}