Browse Source

respect return code from glob()

David Rose 22 years ago
parent
commit
e3ab4966cf
2 changed files with 8 additions and 0 deletions
  1. 4 0
      dtool/src/dtoolutil/filename.cxx
  2. 4 0
      ppremake/filename.cxx

+ 4 - 0
dtool/src/dtoolutil/filename.cxx

@@ -1172,6 +1172,10 @@ scan_directory(vector_string &contents) const {
   glob_t globbuf;
   glob_t globbuf;
 
 
   int r = glob(dirname.c_str(), GLOB_ERR, NULL, &globbuf);
   int r = glob(dirname.c_str(), GLOB_ERR, NULL, &globbuf);
+  if (r != 0 && r != GLOB_NOMATCH) {
+    perror(dirname.c_str());
+    return false;
+  }
   size_t offset = dirname.size() - 1;
   size_t offset = dirname.size() - 1;
 
 
   for (int i = 0; globbuf.gl_pathv[i] != NULL; i++) {
   for (int i = 0; globbuf.gl_pathv[i] != NULL; i++) {

+ 4 - 0
ppremake/filename.cxx

@@ -1172,6 +1172,10 @@ scan_directory(vector_string &contents) const {
   glob_t globbuf;
   glob_t globbuf;
 
 
   int r = glob(dirname.c_str(), GLOB_ERR, NULL, &globbuf);
   int r = glob(dirname.c_str(), GLOB_ERR, NULL, &globbuf);
+  if (r != 0 && r != GLOB_NOMATCH) {
+    perror(dirname.c_str());
+    return false;
+  }
   size_t offset = dirname.size() - 1;
   size_t offset = dirname.size() - 1;
 
 
   for (int i = 0; globbuf.gl_pathv[i] != NULL; i++) {
   for (int i = 0; globbuf.gl_pathv[i] != NULL; i++) {