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:
@@ -29,7 +29,7 @@ void nm_main_utils_ensure_rundir (void);
|
||||
|
||||
gboolean nm_main_utils_write_pidfile (const char *pidfile);
|
||||
|
||||
gboolean nm_main_utils_check_pidfile (const char *pidfile, const char *name);
|
||||
void nm_main_utils_ensure_not_running_pidfile (const char *pidfile);
|
||||
|
||||
gboolean nm_main_utils_early_setup (const char *progname,
|
||||
int *argc,
|
||||
|
Reference in New Issue
Block a user