summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2013-03-21 13:02:46 +0800
committerChromeBot <chrome-bot@google.com>2013-03-20 23:47:53 -0700
commit64ee1530ee55f70a5e65d80cbf584971d7beb1e4 (patch)
tree4b098da9d16535e2ce06f294bf613f69d0b2cd28
parent3f806a2abf07d7b801852a4a6f3a9080a4b5c427 (diff)
downloadvboot-toolchainA.tar.gz
crossystem: Fix cros_debug detection on non-chrome systems.toolchainAstabilize-3912.79.Brelease-R27-3912.B
"cros_debug" is usually the last token of kernel command line on UEFI/legacy BIOS systems. However, kernel command line may end with new line ("\n") and that may cause strcmp to fail (i.e., can't detect "cros_debug" if it's the last parameter in command line), so we need to add that into strtok delimiters. BRANCH=none BUG=chromium:222248 TEST=crossystem cros_debug # display 1 on UEFI system with cros_debug Change-Id: I9aed1562291469118acbadcc5211ff5c45eb9feb Reviewed-on: https://gerrit.chromium.org/gerrit/46106 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
-rw-r--r--host/lib/crossystem.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index c4d0a607..2ef222b0 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -129,6 +129,7 @@ int VbGetCrosDebug(void) {
FILE* f = NULL;
char buf[4096] = "";
char *t, *saveptr;
+ const char *delimiters = " \r\n";
/* If the currently running system specifies its debug status, use
* that in preference to other indicators. */
@@ -138,7 +139,8 @@ int VbGetCrosDebug(void) {
buf[0] = 0;
fclose(f);
}
- for (t = strtok_r(buf, " ", &saveptr); t; t=strtok_r(NULL, " ", &saveptr)) {
+ for (t = strtok_r(buf, delimiters, &saveptr); t;
+ t = strtok_r(NULL, delimiters, &saveptr)) {
if (0 == strcmp(t, "cros_debug"))
return 1;
else if (0 == strcmp(t, "cros_nodebug"))