diff options
Diffstat (limited to 'src/comp.c')
-rw-r--r-- | src/comp.c | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -350,22 +350,28 @@ component_config_rollback (void) | |||
350 | component_free (list->head); | 350 | component_free (list->head); |
351 | cur = prev_index (); | 351 | cur = prev_index (); |
352 | } | 352 | } |
353 | |||
354 | /* Return true if PROG is a leftover from previous configuration */ | ||
355 | static int | ||
356 | prog_is_leftover (struct prog *prog) | ||
357 | { | ||
358 | return IS_COMPONENT (prog) && !component_is_active (prog->v.p.comp); | ||
359 | } | ||
353 | 360 | ||
361 | /* If PROG is a leftover, gracefully stop it and mark as disabled */ | ||
354 | static int | 362 | static int |
355 | cb_terminate_prog (struct prog *prog, void *data) | 363 | cb_terminate_prog (struct prog *prog, void *data) |
356 | { | 364 | { |
357 | if (IS_COMPONENT (prog) && !component_is_active (prog->v.p.comp)) | 365 | if (prog_is_leftover (prog)) |
358 | { | 366 | progman_stop_component (&prog); |
359 | progman_stop_component (prog); | ||
360 | prog->v.p.comp->flags |= CF_DISABLED; | ||
361 | } | ||
362 | return 0; | 367 | return 0; |
363 | } | 368 | } |
364 | 369 | ||
370 | /* If PROG is a leftover, slay it with SIGKILL */ | ||
365 | static int | 371 | static int |
366 | cb_kill_prog (struct prog *prog, void *data) | 372 | cb_kill_prog (struct prog *prog, void *data) |
367 | { | 373 | { |
368 | if (!(IS_COMPONENT (prog) && component_is_active (prog->v.p.comp))) | 374 | if (prog_is_leftover (prog)) |
369 | prog_stop (prog, SIGKILL); | 375 | prog_stop (prog, SIGKILL); |
370 | return 0; | 376 | return 0; |
371 | } | 377 | } |
@@ -509,7 +515,7 @@ component_config_commit (void) | |||
509 | progman_wait_until (list_is_empty, list); | 515 | progman_wait_until (list_is_empty, list); |
510 | } | 516 | } |
511 | } | 517 | } |
512 | 518 | ||
513 | /* Build dependency map */ | 519 | /* Build dependency map */ |
514 | component_build_depmap (); | 520 | component_build_depmap (); |
515 | 521 | ||