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.
This commit is contained in:
14
src/main.c
14
src/main.c
@@ -339,6 +339,13 @@ main (int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
setenv ("GIO_USE_VFS", "local", 1);
|
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 ()) {
|
if (!g_module_supported ()) {
|
||||||
fprintf (stderr, _("GModules are not supported on your platform!\n"));
|
fprintf (stderr, _("GModules are not supported on your platform!\n"));
|
||||||
exit (1);
|
exit (1);
|
||||||
@@ -478,13 +485,6 @@ main (int argc, char *argv[])
|
|||||||
g_log_set_always_fatal (fatal_mask);
|
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 ();
|
g_type_init ();
|
||||||
dbus_threads_init_default ();
|
dbus_threads_init_default ();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user