aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2015-09-11 15:20:32 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2015-09-11 15:20:32 +0100
commit7c928f726d68d925a0f5f6fe8843ebee7738963f (patch)
tree1a8bea5d9cd15c9ef39cb6a0e54b778f0da1ba9e
parent42b6aad9ef7d70975b910e3f2835b03d5ae2d8bb (diff)
downloadgcc-7c928f726d68d925a0f5f6fe8843ebee7738963f.zip
gcc-7c928f726d68d925a0f5f6fe8843ebee7738963f.tar.gz
gcc-7c928f726d68d925a0f5f6fe8843ebee7738963f.tar.bz2
Fix filesystem::canonical on Solaris 10.
PR libstdc++/67173 * src/filesystem/ops.cc (filesystem::canonical): Allocate buffer for realpath on Solaris 10. From-SVN: r227689
-rw-r--r--libstdc++-v3/ChangeLog4
-rw-r--r--libstdc++-v3/src/filesystem/ops.cc7
2 files changed, 10 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b4618ef..d425f49 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,9 @@
2015-09-11 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/67173
+ * src/filesystem/ops.cc (filesystem::canonical): Allocate buffer for
+ realpath on Solaris 10.
+
PR libstdc++/65142
* src/c++11/random.cc (random_device::_M_getval()): Check read result.
diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc
index 661685a..cefb927 100644
--- a/libstdc++-v3/src/filesystem/ops.cc
+++ b/libstdc++-v3/src/filesystem/ops.cc
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
+#include <limits.h> // PATH_MAX
#ifdef _GLIBCXX_HAVE_UNISTD_H
# include <unistd.h>
# if defined(_GLIBCXX_HAVE_SYS_STAT_H) && defined(_GLIBCXX_HAVE_SYS_TYPES_H)
@@ -97,7 +98,11 @@ fs::canonical(const path& p, const path& base, error_code& ec)
{
path can;
#ifdef _GLIBCXX_USE_REALPATH
- if (char_ptr rp = char_ptr{::realpath(absolute(p, base).c_str(), nullptr)})
+ char* buffer = nullptr;
+#if defined(__SunOS_5_10) && defined(PATH_MAX)
+ buffer = (char*)::malloc(PATH_MAX);
+#endif
+ if (char_ptr rp = char_ptr{::realpath(absolute(p, base).c_str(), buffer)})
{
can.assign(rp.get());
ec.clear();