sd-device: check netlink netns matches host netns before using monitor
authorLennart Poettering <lennart@poettering.net>
Tue, 26 May 2020 21:27:20 +0000 (23:27 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 29 May 2020 06:28:10 +0000 (15:28 +0900)
commitf6dbcebdc28cabf36e6665b67d52d43192fb88df
tree78e352676b149fb55ffdb080c28880cea35bf1ea
parent8abbd9a4d94ef3d66b4d04f0584921b35059c3f9
sd-device: check netlink netns matches host netns before using monitor

Tracking down #15931 confused the hell out of me, since running homed in
gdb from the command line worked fine, but doing so as a service failed.
Let's make this more debuggable and check if we live in the host netns
when allocating a new udev monitor.

This is just debug stuff, so that if things don't work, a quick debug
run will reveal what is going on.

That said, while we are at it, also fix unexpected closing of passed in
fd when failing.
src/basic/missing_socket.h
src/libsystemd/sd-device/device-monitor.c