main: refactor nm_main_utils_check_pidfile() to exit directly on failure
And rename the function to nm_main_utils_ensure_not_running_pidfile() to match the other _ensure_ functions that exit(1). Also no longer pass @name to nm_main_utils_ensure_not_running_pidfile() and use g_get_prgname() instead. nm_main_utils_ensure_not_running_pidfile() checks that the running process has the same program name, so this changes behavior if the user renamed the binary. Before, we would check whether the running process is named 'NetworkManager' ('nm-iface-helper'). Now we check whether the process has the same name as the current process. This means, that if you rename the binary to 'NetworkManager2' we would now only detect a conflicting 'NetworkManager2'. Before we would only detect conflicting 'NetworkManager' binaries.
This commit is contained in:
@@ -318,9 +318,7 @@ main (int argc, char *argv[])
|
||||
|
||||
nm_main_utils_ensure_rundir ();
|
||||
|
||||
/* check pid file */
|
||||
if (nm_main_utils_check_pidfile (global_opt.pidfile, "NetworkManager"))
|
||||
exit (1);
|
||||
nm_main_utils_ensure_not_running_pidfile (global_opt.pidfile);
|
||||
|
||||
/* Read the config file and CLI overrides */
|
||||
config = nm_config_setup (config_cli, &error);
|
||||
|
Reference in New Issue
Block a user