[shibboleth-sp2] 08/11: New patch Check-for-strerror_r-with-C-language-selected.patch
Ferenc Wágner
wferi at moszumanska.debian.org
Thu Aug 11 12:48:28 UTC 2016
This is an automated email from the git hooks/post-receive script.
wferi pushed a commit to branch debian/master
in repository shibboleth-sp2.
commit cfe543359daf30f67d7829aad95737de81b7849f
Author: Ferenc Wágner <wferi at niif.hu>
Date: Mon Jul 18 16:54:00 2016 +0200
New patch Check-for-strerror_r-with-C-language-selected.patch
Check for strerror_r() with C++ language selected
---
...k-for-strerror_r-with-C-language-selected.patch | 55 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 56 insertions(+)
diff --git a/debian/patches/Check-for-strerror_r-with-C-language-selected.patch b/debian/patches/Check-for-strerror_r-with-C-language-selected.patch
new file mode 100644
index 0000000..92b058e
--- /dev/null
+++ b/debian/patches/Check-for-strerror_r-with-C-language-selected.patch
@@ -0,0 +1,55 @@
+From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi at niif.hu>
+Date: Mon, 18 Jul 2016 12:58:16 +0200
+Subject: Check for strerror_r() with C++ language selected
+
+On GNU/Linux, g++ always defines the preprocessor macro _GNU_SOURCE
+because libstdc++ requires it. This in turn selects the GNU version of
+strerror_r(), which returns char* and may not use the passed buffer.
+
+https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.predefined
+---
+ configure.ac | 2 +-
+ shibsp/remoting/impl/SocketListener.cpp | 10 +++++++---
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 611cf2e..b8f26c6 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -74,7 +74,6 @@ AC_STRUCT_TM
+
+ # Checks for library functions.
+ AC_FUNC_STRFTIME
+-AC_FUNC_STRERROR_R
+ AC_CHECK_HEADERS([sys/utsname.h grp.h pwd.h])
+ AC_CHECK_HEADERS([sys/socket.h], [AC_DEFINE([SHIBSP_HAVE_SYS_SOCKET_H],[1],[Define to 1 if you have the <sys/socket> header file.])], [])
+ AC_CHECK_FUNCS([strchr strdup strstr timegm gmtime_r localtime_r strtok_r strcasecmp getpwnam getgrnam initgroups])
+@@ -130,6 +129,7 @@ CPPFLAGS="$SSLFLAGS $CPPFLAGS"
+ AC_CHECK_HEADER([openssl/x509.h],,AC_MSG_ERROR([unable to find openssl header files]))
+
+ AC_LANG([C++])
++AC_FUNC_STRERROR_R
+
+ # C++ requirements
+ AC_CXX_NAMESPACES
+diff --git a/shibsp/remoting/impl/SocketListener.cpp b/shibsp/remoting/impl/SocketListener.cpp
+index 8951175..e060631 100644
+--- a/shibsp/remoting/impl/SocketListener.cpp
++++ b/shibsp/remoting/impl/SocketListener.cpp
+@@ -397,9 +397,13 @@ bool SocketListener::log_error(const char* fn) const
+ #endif
+ #ifdef HAVE_STRERROR_R
+ char buf[256];
+- memset(buf,0,sizeof(buf));
+- strerror_r(rc,buf,sizeof(buf));
+- log->error("socket call (%s) resulted in error (%d): %s",fn, rc, isprint(*buf) ? buf : "no message");
++ const char *msg;
++#ifdef STRERROR_R_CHAR_P
++ msg = strerror_r(rc,buf,sizeof(buf));
++#else
++ msg = strerror_r(rc,buf,sizeof(buf)) ? "<translation failed>" : buf;
++#endif
++ log->error("socket call (%s) resulted in error (%d): %s", fn, rc, msg);
+ #else
+ const char* buf=strerror(rc);
+ log->error("socket call (%s) resulted in error (%d): %s", fn, rc, isprint(*buf) ? buf : "no message");
diff --git a/debian/patches/series b/debian/patches/series
index 1143b4d..2f86e1a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ Remove-WSTrust-schema-references.patch
Debianize-the-systemd-service-file-of-shibd.patch
Search-for-libsystemd-instead-of-libsystemd-daemon.patch
Add-Documentation-key-to-shibd-service-file.patch
+Check-for-strerror_r-with-C-language-selected.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-shibboleth/shibboleth-sp2.git
More information about the Pkg-shibboleth-devel
mailing list