diff options
author | Wink Saville <wink@google.com> | 2011-07-07 11:05:51 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-07-07 11:05:51 -0700 |
commit | 8bddafa3572f0d0cbc4b85b125d6473682fd38e9 (patch) | |
tree | 9de76a41d26afbe2be9e1de02a4bae7b3e7f6725 /cmds/dumpstate | |
parent | b083fa61d9411e9c1f3933fd8657d86e99e7eccd (diff) | |
parent | 5eeeea29ecd731897211d31bde7ee87af182420c (diff) | |
download | frameworks_base-8bddafa3572f0d0cbc4b85b125d6473682fd38e9.zip frameworks_base-8bddafa3572f0d0cbc4b85b125d6473682fd38e9.tar.gz frameworks_base-8bddafa3572f0d0cbc4b85b125d6473682fd38e9.tar.bz2 |
am 5eeeea29: am 97667d0c: Merge "Allow vril-dump to work on user builds" into honeycomb-LTE
* commit '5eeeea29ecd731897211d31bde7ee87af182420c':
Allow vril-dump to work on user builds
Diffstat (limited to 'cmds/dumpstate')
-rw-r--r-- | cmds/dumpstate/dumpstate.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c index 21bb62e..42c35af 100644 --- a/cmds/dumpstate/dumpstate.c +++ b/cmds/dumpstate/dumpstate.c @@ -47,9 +47,11 @@ static void dumpstate() { char build[PROPERTY_VALUE_MAX], fingerprint[PROPERTY_VALUE_MAX]; char radio[PROPERTY_VALUE_MAX], bootloader[PROPERTY_VALUE_MAX]; char network[PROPERTY_VALUE_MAX], date[80]; + char build_type[PROPERTY_VALUE_MAX]; property_get("ro.build.display.id", build, "(unknown)"); property_get("ro.build.fingerprint", fingerprint, "(unknown)"); + property_get("ro.build.type", build_type, "(unknown)"); property_get("ro.baseband", radio, "(unknown)"); property_get("ro.bootloader", bootloader, "(unknown)"); property_get("gsm.operator.alpha", network, "(unknown)"); @@ -136,9 +138,17 @@ static void dumpstate() { #ifdef BROKEN_VRIL_IS_FIXED_B_4442803 char ril_dumpstate_timeout[PROPERTY_VALUE_MAX] = {0}; property_get("ril.dumpstate.timeout", ril_dumpstate_timeout, "30"); - if (strlen(ril_dumpstate_timeout) > 0) { - run_command("DUMP VENDOR RIL LOGS", atoi(ril_dumpstate_timeout), - "su", "root", "vril-dump", NULL); + if (strnlen(ril_dumpstate_timeout, PROPERTY_VALUE_MAX - 1) > 0) { + if (0 == strncmp(build_type, "user", PROPERTY_VALUE_MAX - 1)) { + // su does not exist on user builds, so try running without it. + // This way any implementations of vril-dump that do not require + // root can run on user builds. + run_command("DUMP VENDOR RIL LOGS", atoi(ril_dumpstate_timeout), + "vril-dump", NULL); + } else { + run_command("DUMP VENDOR RIL LOGS", atoi(ril_dumpstate_timeout), + "su", "root", "vril-dump", NULL); + } } #endif @@ -275,7 +285,7 @@ int main(int argc, char *argv[]) { if (getuid() == 0) { /* switch to non-root user and group */ - gid_t groups[] = { AID_LOG, AID_SDCARD_RW, AID_MOUNT }; + gid_t groups[] = { AID_LOG, AID_SDCARD_RW, AID_MOUNT, AID_INET }; if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) { LOGE("Unable to setgroups, aborting: %s\n", strerror(errno)); return -1; |