summaryrefslogtreecommitdiff
path: root/src/udev/udevadm-monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/udevadm-monitor.c')
-rw-r--r--src/udev/udevadm-monitor.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c
index f7737d0790..3dde3f338a 100644
--- a/src/udev/udevadm-monitor.c
+++ b/src/udev/udevadm-monitor.c
@@ -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);