diff options
author | JP Abgrall <jpa@google.com> | 2011-01-21 22:32:00 -0800 |
---|---|---|
committer | JP Abgrall <jpa@google.com> | 2011-01-26 10:58:29 -0800 |
commit | 8935bcacd2b760bd81ea5636b0e9b27629b957f8 (patch) | |
tree | 09768953711010a942c0167b08f4e22e2aa045b6 /cmds | |
parent | 1df27c02ec96fd2a4a17494cdef4fea8610ecc7c (diff) | |
download | frameworks_base-8935bcacd2b760bd81ea5636b0e9b27629b957f8.zip frameworks_base-8935bcacd2b760bd81ea5636b0e9b27629b957f8.tar.gz frameworks_base-8935bcacd2b760bd81ea5636b0e9b27629b957f8.tar.bz2 |
dumpstate: improved collection, better error handling.
- Some of the commands used by dumpstate, which drops root, will not collect
anything during a bug report. E.g. df fails on /mnt/secure/asec.
- force flushing of error message
. without the flush (using gingerbread and not master)
*** netcfg: Exit code 255
. with the flush()
*** exec(netcfg): Permission denied
*** netcfg: Exit code 255
- add a check before using WEXITSTATUS()
Change-Id: Ia3924b9cc8a12cecab894cbf7f2c79614a358d34
Signed-off-by: JP Abgrall <jpa@google.com>
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/dumpstate/dumpstate.c | 2 | ||||
-rw-r--r-- | cmds/dumpstate/utils.c | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c index b1b7715..f74e3c8 100644 --- a/cmds/dumpstate/dumpstate.c +++ b/cmds/dumpstate/dumpstate.c @@ -143,7 +143,7 @@ static void dumpstate() { dump_file("BINDER STATS", "/sys/kernel/debug/binder/stats"); dump_file("BINDER STATE", "/sys/kernel/debug/binder/state"); - run_command("FILESYSTEMS & FREE SPACE", 10, "df", NULL); + run_command("FILESYSTEMS & FREE SPACE", 10, "su", "root", "df", NULL); dump_file("PACKAGE SETTINGS", "/data/system/packages.xml"); dump_file("PACKAGE UID ERRORS", "/data/system/uiderrors.txt"); diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c index f92acbb..b2f9e80 100644 --- a/cmds/dumpstate/utils.c +++ b/cmds/dumpstate/utils.c @@ -167,6 +167,7 @@ int run_command(const char *title, int timeout_seconds, const char *command, ... execvp(command, (char**) args); printf("*** exec(%s): %s\n", command, strerror(errno)); + fflush(stdout); _exit(-1); } @@ -178,7 +179,7 @@ int run_command(const char *title, int timeout_seconds, const char *command, ... if (p == pid) { if (WIFSIGNALED(status)) { printf("*** %s: Killed by signal %d\n", command, WTERMSIG(status)); - } else if (WEXITSTATUS(status) > 0) { + } else if (WIFEXITED(status) && WEXITSTATUS(status) > 0) { printf("*** %s: Exit code %d\n", command, WEXITSTATUS(status)); } if (title) printf("[%s: %.1fs elapsed]\n\n", command, elapsed); |