chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
024f268
)
swap: refuse start/stop of swaps in container
author
Lennart Poettering
<lennart@poettering.net>
Fri, 24 Aug 2012 21:00:13 +0000
(23:00 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Tue, 4 Sep 2012 01:59:05 +0000
(18:59 -0700)
src/core/swap.c
patch
|
blob
|
history
diff --git
a/src/core/swap.c
b/src/core/swap.c
index cd4d9ab3d743dbcea9e0186e8b0050f8a10af4bf..41ece2708f009a3b52d061ee76e45595659d0161 100644
(file)
--- a/
src/core/swap.c
+++ b/
src/core/swap.c
@@
-39,6
+39,7
@@
#include "exit-status.h"
#include "def.h"
#include "path-util.h"
#include "exit-status.h"
#include "def.h"
#include "path-util.h"
+#include "virt.h"
static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = {
[SWAP_DEAD] = UNIT_INACTIVE,
static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = {
[SWAP_DEAD] = UNIT_INACTIVE,
@@
-797,6
+798,9
@@
static int swap_start(Unit *u) {
assert(s->state == SWAP_DEAD || s->state == SWAP_FAILED);
assert(s->state == SWAP_DEAD || s->state == SWAP_FAILED);
+ if (detect_container(NULL) > 0)
+ return -EPERM;
+
s->result = SWAP_SUCCESS;
swap_enter_activating(s);
return 0;
s->result = SWAP_SUCCESS;
swap_enter_activating(s);
return 0;
@@
-817,6
+821,9
@@
static int swap_stop(Unit *u) {
assert(s->state == SWAP_ACTIVATING ||
s->state == SWAP_ACTIVE);
assert(s->state == SWAP_ACTIVATING ||
s->state == SWAP_ACTIVE);
+ if (detect_container(NULL) > 0)
+ return -EPERM;
+
swap_enter_deactivating(s);
return 0;
}
swap_enter_deactivating(s);
return 0;
}