From 99918b8f3ad2bec78969434365a3be6ba5f44cdd Mon Sep 17 00:00:00 2001 From: Ulrich Ölmann Date: Sun, 3 Feb 2019 22:47:58 +0100 Subject: barebox-state: fix usage of multiple state instances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's assume there are two state instances named "blue" (with variable "x") and "yellow" (with variable "y") then $ barebox-state --name blue --get x $ barebox-state --name yellow --get y would both work, whereas only exactly one of the alternative calls $ barebox-state --get blue.x $ barebox-state --get yellow.y would succeed. This commit fixes that bug. Signed-off-by: Ulrich Ölmann Signed-off-by: Roland Hieber --- src/barebox-state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/barebox-state.c b/src/barebox-state.c index 3e6c260..76d0475 100644 --- a/src/barebox-state.c +++ b/src/barebox-state.c @@ -581,9 +581,10 @@ int main(int argc, char *argv[]) list_for_each_entry(state, &state_list.list, list) { if (strlen(state->name) == statename_len && - !strncmp(state->name, sg->arg, statename_len)) + !strncmp(state->name, sg->arg, statename_len)) { arg = statename_end + 1; break; + } } } if (state == &state_list) { -- cgit v1.2.3