[opensaml2] 11/24: New patch Use-readdir-for-portability-no-PATH_MAX.patch

Ferenc Wágner wferi at moszumanska.debian.org
Tue Aug 30 20:55:02 UTC 2016


This is an automated email from the git hooks/post-receive script.

wferi pushed a commit to branch debian/experimental
in repository opensaml2.

commit 5a9ad82faac66dae932977350581fa0dc2ec35cc
Author: Ferenc Wágner <wferi at niif.hu>
Date:   Fri Jul 1 20:44:01 2016 +0200

    New patch Use-readdir-for-portability-no-PATH_MAX.patch
    
    Use readdir for portability (no PATH_MAX)
---
 .../Use-readdir-for-portability-no-PATH_MAX.patch  | 45 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 46 insertions(+)

diff --git a/debian/patches/Use-readdir-for-portability-no-PATH_MAX.patch b/debian/patches/Use-readdir-for-portability-no-PATH_MAX.patch
new file mode 100644
index 0000000..43985ea
--- /dev/null
+++ b/debian/patches/Use-readdir-for-portability-no-PATH_MAX.patch
@@ -0,0 +1,45 @@
+From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi at niif.hu>
+Date: Tue, 28 Jun 2016 18:42:29 +0200
+Subject: Use readdir for portability (no PATH_MAX)
+
+---
+ saml/saml2/metadata/impl/FolderMetadataProvider.cpp | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/saml/saml2/metadata/impl/FolderMetadataProvider.cpp b/saml/saml2/metadata/impl/FolderMetadataProvider.cpp
+index 425b5ff..f6c5416 100644
+--- a/saml/saml2/metadata/impl/FolderMetadataProvider.cpp
++++ b/saml/saml2/metadata/impl/FolderMetadataProvider.cpp
+@@ -29,6 +29,7 @@
+ #include "saml2/metadata/Metadata.h"
+ #include "saml2/metadata/MetadataProvider.h"
+ 
++#include <errno.h>
+ #include <memory>
+ #include <xercesc/util/XMLUniDefs.hpp>
+ #include <xmltooling/logging.h>
+@@ -114,10 +115,9 @@ namespace opensaml {
+             if (!d) {
+                 throw MetadataException("Folder MetadataProvider unable to open directory ($1)", params(1, loc.c_str()));
+             }
+-            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) {
++            errno = 0;
++            // This loop must run on a single thread, readdir isn't thread-safe
++            while (struct dirent* entptr = readdir(d)) {
+                 if (!strcmp(entptr->d_name, ".") || !strcmp(entptr->d_name, ".."))
+                     continue;
+                 fullname = loc + '/' + entptr->d_name;
+@@ -158,6 +158,10 @@ namespace opensaml {
+             } while (FindNextFile(h, &f));
+             FindClose(h);
+ #else
++                errno = 0;
++            }
++            if (errno) {
++                throw MetadataException("Folder MetadataProvider unable to read directory ($1)", params(1, loc.c_str()));
+             }
+             closedir(d);
+ #endif
diff --git a/debian/patches/series b/debian/patches/series
index c8b2d9a..14813fe 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 Disable-forcing-of-libtool-silent.patch
 Use-pkg-config-for-log4shib-log4cpp.patch
 Use-pkg-config-for-xmltooling.patch
+Use-readdir-for-portability-no-PATH_MAX.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-shibboleth/opensaml2.git



More information about the Pkg-shibboleth-devel mailing list