diff --git a/ChangeLog b/ChangeLog index 65cdfdcf5..ec0999489 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-05-05 Robert Love + + * 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 * gnome/libnm_glib/libnm_glib.c diff --git a/src/NetworkManager.c b/src/NetworkManager.c index 33ea3b9d1..8953af0c5 100644 --- a/src/NetworkManager.c +++ b/src/NetworkManager.c @@ -743,6 +743,13 @@ int main( int argc, char *argv[] ) 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 (); if (!g_thread_supported ()) g_thread_init (NULL);