# ])
CFLAGS="$GCC_CFLAGS"
CXXFLAGS="$GCC_CXXFLAGS"
-else
-# Fix for Sun Workshop compiler in debug mode, may be Sun case #6360993
- case "${host_cpu}-${host_os}" in
- *solaris*)
- if test "$CXX" = "CC" ; then
- CXXFLAGS="$CXXFLAGS -Qoption ccfe -stabs=no%dfltlit+no%dflthlp"
- fi
- ;;
- esac
fi
+# Fix for Sun Workshop compiler in debug mode, may be Sun case #6360993
+# Also enables POSIX semantics for some functions.
+case "${host_cpu}-${host_os}" in
+ *solaris*)
+ CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
+ CXXFLAGS="$CXXFLAGS -D_POSIX_PTHREAD_SEMANTICS"
+ if test "$CXX" = "CC" ; then
+ CXXFLAGS="$CXXFLAGS -Qoption ccfe -stabs=no%dfltlit+no%dflthlp"
+ fi
+ ;;
+esac
+
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
#include <xmltooling/util/XMLHelper.h>
#ifndef WIN32
-# ifdef HAVE_SYS_TYPES_H && HAVE_DIRENT_H
-# include <sys/types.h>
+# if defined(HAVE_SYS_TYPES_H) && defined(HAVE_DIRENT_H)
# include <dirent.h>
+# include <sys/types.h>
+# include <sys/stat.h>
# else
-# #error Unsupported directory library headers.
+# error Unsupported directory library headers.
# endif
#endif
if (!d) {
throw MetadataException("Folder MetadataProvider unable to open directory ($1)", params(1, loc.c_str()));
}
- struct dirent* ent;
- while(readdir_r(d, ent, &ent) == 0 && ent) {
- if (ent->d_type & DT_DIR) {
- if (strcmp(ent->d_name, ".") && strcmp(ent->d_name, ".."))
- log.warn("nested folders not supported, skipping (%s)", ent->d_name);
+ char dir_buf[sizeof(struct dirent) + PATH_MAX];
+ struct dirent* ent = (struct dirent*)dir_buf;
+ struct dirent* entptr = nullptr;
+ while(readdir_r(d, ent, &entptr) == 0 && entptr) {
+ if (!strcmp(entptr->d_name, ".") || !strcmp(entptr->d_name, ".."))
+ continue;
+ fullname = loc + '/' + entptr->d_name;
+ struct stat stat_buf;
+ if (stat(fullname.c_str(), &stat_buf) != 0) {
+ log.warn("unable to access (%s)", entptr->d_name);
+ continue;
+ }
+ else if (S_ISDIR(stat_buf.st_mode)) {
+ log.warn("nested folders not supported, skipping (%s)", entptr->d_name);
continue;
}
- fullname = loc + '/' + ent->d_name;
log.info("will create metadata source from (%s)", fullname.c_str());
auto_ptr_XMLCh entry(fullname.c_str());
#endif