From 8043d772370d04205d5b2972720458017b022854 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 14 Jun 2013 13:31:11 -0400 Subject: [PATCH] main: Move static assertions after setlocale(), but before option processing These assertions (such as getuid() == 0) don't need to access the config files or commandline arguments, but *do* output localized error messages, so they should be after setlocale(). --- src/main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main.c b/src/main.c index 5d473c9bb1..28f68acf59 100644 --- a/src/main.c +++ b/src/main.c @@ -346,11 +346,6 @@ main (int argc, char *argv[]) */ umask (022); - if (!g_module_supported ()) { - fprintf (stderr, _("GModules are not supported on your platform!\n")); - exit (1); - } - /* Set locale to be able to use environment variables */ setlocale (LC_ALL, ""); @@ -358,6 +353,16 @@ main (int argc, char *argv[]) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); + if (!g_module_supported ()) { + fprintf (stderr, _("GModules are not supported on your platform!\n")); + exit (1); + } + + if (getuid () != 0) { + fprintf (stderr, _("You must be root to run NetworkManager!\n")); + exit (1); + } + /* Parse options */ opt_ctx = g_option_context_new (NULL); g_option_context_set_translation_domain (opt_ctx, GETTEXT_PACKAGE); @@ -382,11 +387,6 @@ main (int argc, char *argv[]) exit (0); } - if (getuid () != 0) { - fprintf (stderr, _("You must be root to run NetworkManager!\n")); - exit (1); - } - /* When running from the build directory, determine our build directory * base and set helper paths in the build tree */ if (run_from_build_dir) {