mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-14 11:58:08 +02:00
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().
This commit is contained in:
parent
d3fd1b7464
commit
8043d77237
1 changed files with 10 additions and 10 deletions
20
src/main.c
20
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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue