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>
This commit is contained in:
Julien Cristau 2009-11-14 18:39:00 +01:00 committed by Keith Packard
parent fb95090730
commit 30be7ceaf2

View File

@ -1151,8 +1151,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