diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-09-08 23:26:28 +0900 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-20 11:43:01 +0200 |
commit | 1ddd500ec4dea4f28ba55d9d9dbb74a4d94e6875 (patch) | |
tree | 34dc6f56df549db8bd42a5cf31fb7741759fca34 | |
parent | e81f9924e838ea355387a32875e213d7bc758f23 (diff) | |
download | systemd-1ddd500ec4dea4f28ba55d9d9dbb74a4d94e6875.tar.gz |
network: do not start device monitor if /sys is read-only
Follow-up for bf331d87171b7750d1c72ab0b140a240c0cf32c3.
(cherry picked from commit d31f33e3c9f6ea3bdc873ee52f4398edbec74527)
(cherry picked from commit 3bf7797f1f5d2c97d3b4c108ca487f8d337e8af2)
-rw-r--r-- | src/network/networkd-manager.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index f1549f733f..7457ced469 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -33,11 +33,11 @@ #include "path-util.h" #include "set.h" #include "signal-util.h" +#include "stat-util.h" #include "strv.h" #include "sysctl-util.h" #include "tmpfile-util.h" #include "udev-util.h" -#include "virt.h" /* use 128 MB for receive socket kernel queue. */ #define RCVBUF_SIZE (128*1024*1024) @@ -249,10 +249,9 @@ static int manager_udev_process_link(sd_device_monitor *monitor, sd_device *devi static int manager_connect_udev(Manager *m) { int r; - /* udev does not initialize devices inside containers, - * so we rely on them being already initialized before - * entering the container */ - if (detect_container() > 0) + /* udev does not initialize devices inside containers, so we rely on them being already + * initialized before entering the container. */ + if (path_is_read_only_fs("/sys") > 0) return 0; r = sd_device_monitor_new(&m->device_monitor); |