core: introduce unit_destroy_runtime_directory()
Currently `unit_will_restart()` can return true only when the unit is service. Hence, should not change anything.
This commit is contained in:
+2
-4
@@ -1789,10 +1789,8 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
|
||||
/* We want fresh tmpdirs in case service is started again immediately */
|
||||
s->exec_runtime = exec_runtime_unref(s->exec_runtime, true);
|
||||
|
||||
if (s->exec_context.runtime_directory_preserve_mode == EXEC_PRESERVE_NO ||
|
||||
(s->exec_context.runtime_directory_preserve_mode == EXEC_PRESERVE_RESTART && !service_will_restart(UNIT(s))))
|
||||
/* Also, remove the runtime directory */
|
||||
exec_context_destroy_runtime_directory(&s->exec_context, UNIT(s)->manager->prefix[EXEC_DIRECTORY_RUNTIME]);
|
||||
/* Also, remove the runtime directory */
|
||||
unit_destroy_runtime_directory(UNIT(s), &s->exec_context);
|
||||
|
||||
/* Get rid of the IPC bits of the user */
|
||||
unit_unref_uid_gid(UNIT(s), true);
|
||||
|
||||
@@ -5880,6 +5880,12 @@ int unit_test_trigger_loaded(Unit *u) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void unit_destroy_runtime_directory(Unit *u, const ExecContext *context) {
|
||||
if (context->runtime_directory_preserve_mode == EXEC_PRESERVE_NO ||
|
||||
(context->runtime_directory_preserve_mode == EXEC_PRESERVE_RESTART && !unit_will_restart(u)))
|
||||
exec_context_destroy_runtime_directory(context, u->manager->prefix[EXEC_DIRECTORY_RUNTIME]);
|
||||
}
|
||||
|
||||
int unit_clean(Unit *u, ExecCleanMask mask) {
|
||||
UnitActiveState state;
|
||||
|
||||
|
||||
@@ -860,6 +860,7 @@ int unit_failure_action_exit_status(Unit *u);
|
||||
|
||||
int unit_test_trigger_loaded(Unit *u);
|
||||
|
||||
void unit_destroy_runtime_directory(Unit *u, const ExecContext *context);
|
||||
int unit_clean(Unit *u, ExecCleanMask mask);
|
||||
int unit_can_clean(Unit *u, ExecCleanMask *ret_mask);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user