diff options
author | Daniel Mack <github@zonque.org> | 2016-01-29 16:04:03 +0100 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2016-01-29 16:04:03 +0100 |
commit | 0e3a930a60de12a54419b19484183bf6df92548e (patch) | |
tree | 2729a43c0ac3fd5d7914f23c332329ed4988698d /src/basic | |
parent | e0d2df39b1a4681b523dba9bfa2d709b2cef07bb (diff) | |
parent | d152dd467afe0eacb322900ea7f91946c55c40e9 (diff) |
Merge pull request #2465 from poettering/systemctl-chroot
Fix for #2015
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/verbs.c | 6 | ||||
-rw-r--r-- | src/basic/verbs.h | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/basic/verbs.c b/src/basic/verbs.c index 7feb47c48e..6dded9fb77 100644 --- a/src/basic/verbs.c +++ b/src/basic/verbs.c @@ -28,6 +28,7 @@ #include "macro.h" #include "string-util.h" #include "verbs.h" +#include "virt.h" int dispatch_verb(int argc, char *argv[], const Verb verbs[], void *userdata) { const Verb *verb; @@ -84,6 +85,11 @@ int dispatch_verb(int argc, char *argv[], const Verb verbs[], void *userdata) { return -EINVAL; } + if ((verb->flags & VERB_NOCHROOT) && running_in_chroot() > 0) { + log_info("Running in chroot, ignoring request."); + return 0; + } + if (name) return verb->dispatch(left, argv + optind, userdata); else { diff --git a/src/basic/verbs.h b/src/basic/verbs.h index d59e4d59b8..4132cad773 100644 --- a/src/basic/verbs.h +++ b/src/basic/verbs.h @@ -22,7 +22,8 @@ ***/ #define VERB_ANY ((unsigned) -1) -#define VERB_DEFAULT 1 +#define VERB_DEFAULT 1U +#define VERB_NOCHROOT 2U typedef struct { const char *verb; |