diff --git a/src/barebox-state.c b/src/barebox-state.c index 1d35b39..4179e64 100644 --- a/src/barebox-state.c +++ b/src/barebox-state.c @@ -429,6 +429,7 @@ int lock_fd; int nr_states = 0; bool readonly = true; + const char *default_state = "state"; INIT_LIST_HEAD(&sg_list); INIT_LIST_HEAD(&state_list.list); @@ -477,6 +478,16 @@ } } + if (nr_states == 0) { + struct state_list *new_state; + + new_state = xzalloc(sizeof(*new_state)); + new_state->name = default_state; + + list_add_tail(&new_state->list, &state_list.list); + ++nr_states; + } + lock_fd = open("/var/lock/barebox-state", O_CREAT | O_RDWR, 0600); if (lock_fd < 0) { fprintf(stderr, "Failed to open lock-file /var/lock/barebox-state\n");