]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/verbs.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / basic / verbs.c
index 7feb47c48e114ce0eca3a7f38e066913b3da0d98..cc1bd7e3231aef1d718be11078dfb7443cee702f 100644 (file)
@@ -1,5 +1,4 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
@@ -28,6 +27,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 +84,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 {