mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
prevent crash on some glob.h versions
This commit is contained in:
parent
33f587a56d
commit
08ea68e8ab
@ -1210,12 +1210,23 @@ 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) {
|
||||||
|
// Some error processing the match string. If our version of
|
||||||
|
// glob.h defines GLOB_NOMATCH, then we can differentiate an empty
|
||||||
|
// return result from some other kind of error.
|
||||||
#ifdef GLOB_NOMATCH
|
#ifdef GLOB_NOMATCH
|
||||||
if (r != 0 && r != GLOB_NOMATCH) {
|
if (r != GLOB_NOMATCH) {
|
||||||
perror(dirname.c_str());
|
perror(dirname.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Otherwise, all errors mean the same thing: no matches, but
|
||||||
|
// otherwise no problem.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
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++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user