summaryrefslogtreecommitdiff
path: root/hw/xfree86/parser
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-12-07 12:13:37 -0800
committerKeith Packard <keithp@keithp.com>2011-12-07 12:13:37 -0800
commit3824f558cc2ee051da8314c7bf08b8647b44e84a (patch)
tree9ce3895f6c3da373adba6890444f79988928236b /hw/xfree86/parser
parentfd976e4051e15ab2d01ec0bf89ff26926d4ed04e (diff)
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@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'hw/xfree86/parser')
-rw-r--r--hw/xfree86/parser/scan.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 9099227bb..156bc299a 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);