Skip to content

core: create GMainLoop after daemonizing

g_main_loop_new() creates a new file descriptor (via eventfd()). If NetworkManager has been started with stdin/stdout/stderr closed, the event file descriptor will get number 0 (which is perfectly ok). But the later call to daemon(0, 0) then closes fds 0, 1 and 2, which destroys the previously created eventfd.

As a side effect, creating the GMainLoop later avoids a one time memory leak for the cases where NetworkManager exits immediately (like --version).

Signed-off-by: Christian Eggers ceggers@arri.de

Merge request reports