Checks if /proc/modules exist before calling lsmod.
Change-Id: I8de20d5b99cf613d8d4af699ab8487d27e79bb3f
Fixes: 29276583
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 5bfa919..f50fb73 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -691,7 +691,12 @@
run_command("PRINTENV", 10, "printenv", NULL);
run_command("NETSTAT", 10, "netstat", "-n", NULL);
- run_command("LSMOD", 10, "lsmod", NULL);
+ struct stat s;
+ if (stat("/proc/modules", &s) != 0) {
+ MYLOGD("Skipping 'lsmod' because /proc/modules does not exist\n");
+ } else {
+ run_command("LSMOD", 10, "lsmod", NULL);
+ }
do_dmesg();