xfree86: set a sane umask before opening the log

Xorg creates its log file following the umask of the user running
startx, which may result in a world-writable log.  Set umask to 022 to
prevent this.

Debian bug#555308 <http://bugs.debian.org/555308>
See also http://thread.gmane.org/gmane.comp.security.oss.general/2299

Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 30be7ceaf2)
This commit is contained in:
Julien Cristau 2009-11-14 18:39:00 +01:00 committed by Peter Hutterer
parent e6872c89bc
commit bebf7b1a34

View file

@ -1142,8 +1142,10 @@ OsVendorInit(void)
signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
#endif
if (!beenHere)
if (!beenHere) {
umask(022);
xf86LogInit();
}
/* Set stderr to non-blocking. */
#ifndef O_NONBLOCK