core: when restarting services, don't close fds

We would close all the stored fds in service_release_resources(), which of
course broke the whole concept of storing fds over service restart.

Fixes #4408.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2016-11-01 21:20:21 -04:00
parent 99bdcdc7fc
commit f0bfbfac43
3 changed files with 20 additions and 10 deletions
+4 -2
View File
@@ -302,6 +302,7 @@ int unit_set_description(Unit *u, const char *description) {
bool unit_check_gc(Unit *u) {
UnitActiveState state;
bool inactive;
assert(u);
if (u->job)
@@ -311,16 +312,17 @@ bool unit_check_gc(Unit *u) {
return true;
state = unit_active_state(u);
inactive = state == UNIT_INACTIVE;
/* If the unit is inactive and failed and no job is queued for
* it, then release its runtime resources */
if (UNIT_IS_INACTIVE_OR_FAILED(state) &&
UNIT_VTABLE(u)->release_resources)
UNIT_VTABLE(u)->release_resources(u);
UNIT_VTABLE(u)->release_resources(u, inactive);
/* But we keep the unit object around for longer when it is
* referenced or configured to not be gc'ed */
if (state != UNIT_INACTIVE)
if (!inactive)
return true;
if (u->no_gc)