Created constant for maximun number of args.
BUG: 26379932
Change-Id: I839f6e3f90010ee35bc5d40e96218e9c95afdf4e
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index a4ef686..0d8a0ea 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -278,11 +278,12 @@
std::string timeout_string = std::to_string(timeout_seconds);
- const char *dumpsys_args[ARG_MAX] = { "/system/bin/dumpsys", "-t", timeout_string.c_str()};
+ const char *dumpsys_args[MAX_ARGS_ARRAY_SIZE] =
+ { "/system/bin/dumpsys", "-t", timeout_string.c_str()};
int index = 3; // 'dumpsys' '-t' 'TIMEOUT'
for (const std::string& arg : args) {
- if (index > ARG_MAX - 2) {
+ if (index > MAX_ARGS_ARRAY_SIZE - 2) {
MYLOGE("Too many arguments for '%s': %d\n", title.c_str(), (int) args.size());
return;
}