From 0b9aad7568bc5f1cf56e01fe2b3dc57f5dff5133 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 23 Jan 2015 13:14:29 -0500 Subject: [PATCH] KWSys 2015-01-23 (d4e7f08e) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ d4e7f08e | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' b33e7b96..d4e7f08e Brad King (1): d4e7f08e Directory: Check opendir return value before using it Change-Id: I3485ec9c7ad3b7f25df610d4d1898c5150a995f0 --- Directory.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Directory.cxx b/Directory.cxx index 04b2866133..58cea63550 100644 --- a/Directory.cxx +++ b/Directory.cxx @@ -244,6 +244,11 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na { DIR* dir = opendir(name.c_str()); + if (!dir) + { + return 0; + } + unsigned long count = 0; for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir) ) {