2006-05-05 Robert Love <rml@novell.com>

* src/NetworkManager.c: Set the umask to 0022 when daemonizing, in case
	  root has a wacky default of its own (or, more common, a user has a
	  bad umask and uses su/sudo to restart NetworkManager).  Anything other
	  than 0022 does not do what we want with, for example, resolv.conf.  This
	  problem is amplified by our judicious use of fopen(), which uses mode
	  0666 -- implying that the only way to get the permissions we want is
	  with a umask of 0022.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1719 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Robert Love
2006-05-05 19:42:20 +00:00
committed by Robert Love
parent 8a2815e4ac
commit f1fb0b5e24
2 changed files with 17 additions and 0 deletions

View File

@@ -1,3 +1,13 @@
2006-05-05 Robert Love <rml@novell.com>
* src/NetworkManager.c: Set the umask to 0022 when daemonizing, in case
root has a wacky default of its own (or, more common, a user has a
bad umask and uses su/sudo to restart NetworkManager). Anything other
than 0022 does not do what we want with, for example, resolv.conf. This
problem is amplified by our judicious use of fopen(), which uses mode
0666 -- implying that the only way to get the permissions we want is
with a umask of 0022.
2006-05-05 Dan Williams <dcbw@redhat.com> 2006-05-05 Dan Williams <dcbw@redhat.com>
* gnome/libnm_glib/libnm_glib.c * gnome/libnm_glib/libnm_glib.c

View File

@@ -743,6 +743,13 @@ int main( int argc, char *argv[] )
write_pidfile (pidfile); write_pidfile (pidfile);
} }
/*
* 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 ();
if (!g_thread_supported ()) if (!g_thread_supported ())
g_thread_init (NULL); g_thread_init (NULL);