Ah, I got it. The documentation of udev_monitor_receive_device() says
"The monitor socket is by default set to NONBLOCK. A variant of poll() on the file descriptor returned by udev_monitor_get_fd() should to be used to wake up when new devices arrive, or alternatively the file descriptor switched into blocking mode."
However, wait-for-root does
while ((udev_device = udev_monitor_receive_device (udev_monitor)) != NULL) {
and then just exits. So switching the socket to blocking is indeed the right answer here.
Ah, I got it. The documentation of udev_monitor_ receive_ device( ) says
"The monitor socket is by default set to NONBLOCK. A variant of poll() on the file descriptor returned by udev_monitor_ get_fd( ) should to be used to wake up when new devices arrive, or alternatively the file descriptor switched into blocking mode."
However, wait-for-root does
while ((udev_device = udev_monitor_ receive_ device (udev_monitor)) != NULL) {
and then just exits. So switching the socket to blocking is indeed the right answer here.