Ensure that there is no infinite loop when waiting
for the completion of a status.
Bug-AGL: SPEC-3323
Change-Id: I93537e9bbbe8ef357d112bea1cb6201e96d01ebf
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
static const char *wait_state_stable(int isuser, const char *dpath)
{
static const char *wait_state_stable(int isuser, const char *dpath)
{
+ int trial, count;
+ const char *state = NULL;
+ count = 10;
+ for (trial = 1 ; trial <= count ; trial++) {
state = systemd_unit_state_of_dpath(isuser, dpath);
if (state == NULL || state == SysD_State_Active
|| state == SysD_State_Failed)
return state;
state = systemd_unit_state_of_dpath(isuser, dpath);
if (state == NULL || state == SysD_State_Active
|| state == SysD_State_Failed)
return state;