From d3fd1b7464abd07f4a6cbd320f05712a9c5979fa Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 14 Jun 2013 13:30:11 -0400 Subject: [PATCH] main: Set umask earlier Since we may be creating e.g. pid files before this, we need to set the umask as early as possible. --- src/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index dcfdae352a..5d473c9bb1 100644 --- a/src/main.c +++ b/src/main.c @@ -339,6 +339,13 @@ main (int argc, char *argv[]) */ setenv ("GIO_USE_VFS", "local", 1); + /* + * Set the umask to 0022, which results in 0666 & ~0022 = 0644. + * Otherwise, if root (or an su'ing user) has a wacky umask, we could + * write out an unreadable resolv.conf. + */ + umask (022); + if (!g_module_supported ()) { fprintf (stderr, _("GModules are not supported on your platform!\n")); exit (1); @@ -478,13 +485,6 @@ main (int argc, char *argv[]) g_log_set_always_fatal (fatal_mask); } - /* - * Set the umask to 0022, which results in 0666 & ~0022 = 0644. - * Otherwise, if root (or an su'ing user) has a wacky umask, we could - * write out an unreadable resolv.conf. - */ - umask (022); - g_type_init (); dbus_threads_init_default ();