xserver: Branch 'master'

Keith Packard keithp at kemper.freedesktop.org
Wed Dec 7 12:16:12 PST 2011


 hw/xfree86/parser/scan.c |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit 3824f558cc2ee051da8314c7bf08b8647b44e84a
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Dec 7 12:13:37 2011 -0800

    hw/xfree86: fix segfault in config parser when config dir is missing
    
    Treat a scandir error from a missing (or unusable) directory return as
    if it simply returned no files at all, which is what we want.
    
    cc: Paulo Zanoni <przanoni at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 9099227..156bc29 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -852,6 +852,10 @@ OpenConfigDir(const char *path, const char *cmdline, const char *projroot,
 
 		/* match files named *.conf */
 		num = scandir(dirpath, &list, ConfigFilter, alphasort);
+		if (num < 0) {
+			list = NULL;
+			num = 0;
+		}
 		found = AddConfigDirFiles(dirpath, list, num);
 		if (!found) {
 			free(dirpath);


More information about the xorg-commit mailing list