summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-03-13 23:06:29 +0100
committerThomas Haller <thaller@redhat.com>2015-03-20 11:43:30 +0100
commit12ad2c7fe7ebd94c40edd9a28b81ce27563bb2e3 (patch)
tree2a0b873b2a3682e618c8d932ee8d29a427e8d962 /src/main.c
parent29718fcaa43f52606e4f0b3addbca3f7afb2a224 (diff)
downloadNetworkManager-12ad2c7fe7ebd94c40edd9a28b81ce27563bb2e3.tar.gz
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.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 35a47b9502..77866a473d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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);