diff options
author | Tom Gundersen <teg@jklm.no> | 2015-10-27 18:09:32 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-10-27 18:09:32 +0100 |
commit | dc1e811ebd80d1659d1476c4ae733d212d6aa946 (patch) | |
tree | ee28d0fef1577fdc73e723717a83db225406ce8b /src/core/swap.c | |
parent | 64529a2921a8972878b3f953935f286ce77914e0 (diff) | |
parent | 930d2838f206d725d890c78475312910cd16329a (diff) |
Merge pull request #1698 from poettering/pid-is-unwaited-fix
fixup for previous pr
Diffstat (limited to 'src/core/swap.c')
-rw-r--r-- | src/core/swap.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/core/swap.c b/src/core/swap.c index 6eff6ffb4c..f626ea4d87 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -528,16 +528,16 @@ static int swap_coldplug(Unit *u) { if (new_state == s->state) return 0; - if (new_state == SWAP_ACTIVATING || - new_state == SWAP_ACTIVATING_SIGTERM || - new_state == SWAP_ACTIVATING_SIGKILL || - new_state == SWAP_ACTIVATING_DONE || - new_state == SWAP_DEACTIVATING || - new_state == SWAP_DEACTIVATING_SIGTERM || - new_state == SWAP_DEACTIVATING_SIGKILL) { - - if (s->control_pid <= 0) - return -EBADMSG; + if (s->control_pid > 0 && + pid_is_unwaited(s->control_pid) && + IN_SET(new_state, + SWAP_ACTIVATING, + SWAP_ACTIVATING_SIGTERM, + SWAP_ACTIVATING_SIGKILL, + SWAP_ACTIVATING_DONE, + SWAP_DEACTIVATING, + SWAP_DEACTIVATING_SIGTERM, + SWAP_DEACTIVATING_SIGKILL)) { r = unit_watch_pid(UNIT(s), s->control_pid); if (r < 0) |