From c9babb278f2de86022979db04628e99f333b73c8 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Wed, 15 Jan 2014 22:07:52 +0100 Subject: nvramcui: Trim values when setting. Values get space-padded by curses and then enum search fails to match them. Rtrim to compensate for curses. Change-Id: Iecf095f21cfade9425eaa039b67625615eb80481 Signed-off-by: Vladimir Serbinenko Reviewed-on: http://review.coreboot.org/4692 Reviewed-by: Nico Huber Tested-by: build bot (Jenkins) --- payloads/nvramcui/nvramcui.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'payloads/nvramcui/nvramcui.c') diff --git a/payloads/nvramcui/nvramcui.c b/payloads/nvramcui/nvramcui.c index 04367cd5f9..daf153b9d7 100644 --- a/payloads/nvramcui/nvramcui.c +++ b/payloads/nvramcui/nvramcui.c @@ -232,6 +232,10 @@ int main() for (i = 0; i < numopts; i++) { char *name = field_buffer(fields[2*i], 0); char *value = field_buffer(fields[2*i+1], 0); + char *ptr; + for (ptr = value + strlen (value) - 1; + ptr >= value && *ptr == ' '; ptr--); + ptr[1] = '\0'; set_option_from_string(use_nvram, opttbl, value, name); } -- cgit v1.2.3