diff options
author | Thomas Haller <thaller@redhat.com> | 2015-03-19 15:59:54 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-03-19 16:29:55 +0100 |
commit | fce31c4438cabfc0794db0f227b654a29a4d791c (patch) | |
tree | 9c332d98f45f3bcdffe210db1d95eaa346ef06db | |
parent | 255121392f0d9e9c19125e5a75cb1a3abfd4b200 (diff) | |
download | NetworkManager-fce31c4438cabfc0794db0f227b654a29a4d791c.tar.gz |
fixup! main: (order) move root user check after help/version option
-rw-r--r-- | src/main-utils.c | 5 | ||||
-rw-r--r-- | src/main-utils.h | 2 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/nm-iface-helper.c | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/src/main-utils.c b/src/main-utils.c index a975f0baad..cde5fb8cee 100644 --- a/src/main-utils.c +++ b/src/main-utils.c @@ -36,6 +36,7 @@ #include "gsystem-local-alloc.h" #include "main-utils.h" +#include "NetworkManagerUtils.h" #include "nm-logging.h" static gboolean @@ -174,10 +175,10 @@ nm_main_utils_ensure_not_running_pidfile (const char *pidfile, const char *name) } void -nm_main_utils_ensure_root (const char *progname) +nm_main_utils_ensure_root () { if (getuid () != 0) { - fprintf (stderr, _("You must be root to run %s!\n"), progname); + fprintf (stderr, _("You must be root to run %s!\n"), str_if_set (g_get_prgname (), "")); exit (1); } } diff --git a/src/main-utils.h b/src/main-utils.h index d9ee6ec05a..7bf6195da8 100644 --- a/src/main-utils.h +++ b/src/main-utils.h @@ -23,7 +23,7 @@ #include <glib.h> -void nm_main_utils_ensure_root (const char *progname); +void nm_main_utils_ensure_root (void); void nm_main_utils_setup_signals (GMainLoop *main_loop); diff --git a/src/main.c b/src/main.c index 0b7abb58e9..5b0cb450a7 100644 --- a/src/main.c +++ b/src/main.c @@ -283,7 +283,7 @@ main (int argc, char *argv[]) exit (0); } - nm_main_utils_ensure_root ("NetworkManager"); + nm_main_utils_ensure_root (); if (!nm_logging_setup (global_opt.opt_log_level, global_opt.opt_log_domains, diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c index e8f822c91d..9edf36dc3f 100644 --- a/src/nm-iface-helper.c +++ b/src/nm-iface-helper.c @@ -367,7 +367,7 @@ main (int argc, char *argv[]) exit (0); } - nm_main_utils_ensure_root ("nm-iface-helper"); + nm_main_utils_ensure_root (); if (!global_opt.ifname || !global_opt.uuid) { fprintf (stderr, _("An interface name and UUID are required\n")); |