diff options
author | Keith Packard <keithp@keithp.com> | 2011-12-07 12:13:37 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-12-07 12:13:37 -0800 |
commit | 3824f558cc2ee051da8314c7bf08b8647b44e84a (patch) | |
tree | 9ce3895f6c3da373adba6890444f79988928236b | |
parent | fd976e4051e15ab2d01ec0bf89ff26926d4ed04e (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>
-rw-r--r-- | hw/xfree86/parser/scan.c | 4 |
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); |