[cpp-opensaml COMMIT] in /branches/REL_2: configure.ac saml/saml2/metadata/impl/FolderMetadataProvider.cpp
noreply at shibboleth.net
noreply at shibboleth.net
Tue Nov 15 22:18:18 GMT 2011
Author: scantor
Date: Tue Nov 15 22:18:17 2011
New Revision: 680
URL: http://svn.shibboleth.net/view/cpp-opensaml?rev=680&view=rev
Log:
Enable POSIX signatures on Solaris, and fix Unix directory parsing.
Modified:
branches/REL_2/configure.ac
branches/REL_2/saml/saml2/metadata/impl/FolderMetadataProvider.cpp
Modified: branches/REL_2/configure.ac
URL: http://svn.shibboleth.net/view/cpp-opensaml/branches/REL_2/configure.ac?rev=680&r1=679&r2=680&view=diff
==============================================================================
--- branches/REL_2/configure.ac (original)
+++ branches/REL_2/configure.ac Tue Nov 15 22:18:17 2011
@@ -49,16 +49,19 @@
# ])
CFLAGS="$GCC_CFLAGS"
CXXFLAGS="$GCC_CXXFLAGS"
-else
+fi
+
# 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
+# 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
Modified: branches/REL_2/saml/saml2/metadata/impl/FolderMetadataProvider.cpp
URL: http://svn.shibboleth.net/view/cpp-opensaml/branches/REL_2/saml/saml2/metadata/impl/FolderMetadataProvider.cpp?rev=680&r1=679&r2=680&view=diff
==============================================================================
--- branches/REL_2/saml/saml2/metadata/impl/FolderMetadataProvider.cpp (original)
+++ branches/REL_2/saml/saml2/metadata/impl/FolderMetadataProvider.cpp Tue Nov 15 22:18:17 2011
@@ -37,11 +37,12 @@
#include <xmltooling/util/XMLHelper.h>
#ifndef WIN32
-# ifdef HAVE_SYS_TYPES_H && HAVE_DIRENT_H
+# if defined(HAVE_SYS_TYPES_H) && defined(HAVE_DIRENT_H)
+# include <dirent.h>
# include <sys/types.h>
-# include <dirent.h>
+# include <sys/stat.h>
# else
-# #error Unsupported directory library headers.
+# error Unsupported directory library headers.
# endif
#endif
@@ -112,14 +113,22 @@
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;
}
- fullname = loc + '/' + ent->d_name;
+ else if (S_ISDIR(stat_buf.st_mode)) {
+ log.warn("nested folders not supported, skipping (%s)", entptr->d_name);
+ continue;
+ }
log.info("will create metadata source from (%s)", fullname.c_str());
auto_ptr_XMLCh entry(fullname.c_str());
#endif
More information about the commits
mailing list