]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/udev/udevadm-monitor.c
Merge pull request #11827 from keszybz/pkgconfig-variables
[thirdparty/systemd.git] / src / udev / udevadm-monitor.c
index f7737d079089db6f347c4f2bf51d6856b7db25a7..3dde3f338a7460daa81e65bab700c32283f7494a 100644 (file)
@@ -17,6 +17,7 @@
 #include "signal-util.h"
 #include "string-util.h"
 #include "udevadm.h"
+#include "virt.h"
 
 static bool arg_show_property = false;
 static bool arg_print_kernel = false;
@@ -143,11 +144,11 @@ static int parse_argv(int argc, char *argv[]) {
 
                         slash = strchr(optarg, '/');
                         if (slash) {
-                                devtype = strdup(devtype + 1);
+                                devtype = strdup(slash + 1);
                                 if (!devtype)
                                         return -ENOMEM;
 
-                                subsystem = strndup(optarg, devtype - optarg);
+                                subsystem = strndup(optarg, slash - optarg);
                         } else
                                 subsystem = strdup(optarg);
 
@@ -210,6 +211,11 @@ int monitor_main(int argc, char *argv[], void *userdata) {
         if (r <= 0)
                 goto finalize;
 
+        if (running_in_chroot() > 0) {
+                log_info("Running in chroot, ignoring request.");
+                return 0;
+        }
+
         /* Callers are expecting to see events as they happen: Line buffering */
         setlinebuf(stdout);