From ab38a0543aa667b8d9634bc56117d84ea535f5ea Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Fri, 5 Apr 2013 14:47:45 +0200 Subject: [PATCH] fixed missing length --- lib/Basics/FileUtils.cpp | 7 +++++-- lib/Basics/StringUtils.cpp | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Basics/FileUtils.cpp b/lib/Basics/FileUtils.cpp index 0dc31a1bd0..663ea3a825 100644 --- a/lib/Basics/FileUtils.cpp +++ b/lib/Basics/FileUtils.cpp @@ -94,10 +94,13 @@ namespace triagens { } if (n < 0) { - TRI_CLOSE(fd); + TRI_set_errno(TRI_ERROR_SYS_ERROR); + LOGGER_TRACE("read failed for '" << filename << "' with " << strerror(errno) << " and result " << n << " on fd " << fd); + + TRI_CLOSE(fd); THROW_FILE_FUNC_ERROR("read", "", errno); } @@ -106,7 +109,7 @@ namespace triagens { TRI_CLOSE(fd); - string r(result.c_str()); + string r(result.c_str(), result.length()); return r; } diff --git a/lib/Basics/StringUtils.cpp b/lib/Basics/StringUtils.cpp index 4cfa3db35a..139ac483a5 100644 --- a/lib/Basics/StringUtils.cpp +++ b/lib/Basics/StringUtils.cpp @@ -2976,9 +2976,9 @@ namespace triagens { return ok; } -// ----------------------------------------------------------------------------- + // ----------------------------------------------------------------------------- // BASE64 -// ----------------------------------------------------------------------------- + // ----------------------------------------------------------------------------- string encodeBase64 (string const& in) { unsigned char charArray3[3];