ports/devel/boost-libs/files/patch-libs_stacktrace_build_has__addr2line.cpp
Jan Beich 98eb11b2f0 devel/boost-*: update to 1.65.1
Changes:	http://www.boost.org/users/history/version_1_65_1.html
PR:		218835
Approved by:	maintainer timeout (1.65.1: 2 weeks; 1.65.0: 1 month)
Tested by:	jhibbits (on powerpc64, earlier version)
Exp-run by:	antoine
Differential Revision:	https://reviews.freebsd.org/D11582
2017-09-25 00:08:16 +00:00

36 lines
865 B
C++

Don't overflow return value from main()
--- libs/stacktrace/build/has_addr2line.cpp.orig 2017-07-10 14:19:05 UTC
+++ libs/stacktrace/build/has_addr2line.cpp
@@ -4,22 +4,24 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <cstdlib>
#include <string>
#include <boost/config.hpp>
-#include <unwind.h>
-#include <sys/types.h>
-#include <sys/wait.h>
+#ifdef BOOST_MSVC
+#include <io.h>
+#define X_OK 4
+#define access _access
+#else
+#include <unistd.h>
+#endif
int main() {
#ifdef BOOST_STACKTRACE_ADDR2LINE_LOCATION
std::string s = BOOST_STRINGIZE( BOOST_STACKTRACE_ADDR2LINE_LOCATION );
- s += " -h";
#else
- std::string s = "/usr/bin/addr2line -h";
+ std::string s = "/usr/bin/addr2line";
#endif
- return std::system(s.c_str());
+ return ::access(s.c_str(), X_OK) == -1;
}