1
0
Fork 0

fix file permissions for VERSION file (#4823)

This commit is contained in:
Jan 2018-03-12 17:15:36 +01:00 committed by GitHub
parent cf5ca07ff9
commit c2cda95ce6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -23,6 +23,7 @@
#include "Version.h"
#include "Basics/Common.h"
#include "Basics/FileUtils.h"
#include "Basics/VelocyPackHelper.h"
#include "Basics/files.h"
#include "Logger/Logger.h"
#include "Rest/Version.h"
@ -163,6 +164,5 @@ void Version::write(TRI_vocbase_t* vocbase,
builder.close();
builder.close();
std::string json = builder.slice().toJson();
basics::FileUtils::spit(versionFile, json.c_str(), json.length());
basics::VelocyPackHelper::velocyPackToFile(versionFile, builder.slice(), true);
}

View File

@ -187,13 +187,12 @@ void slurp(std::string const& filename, StringBuffer& result) {
static void throwFileWriteError(std::string const& filename) {
TRI_set_errno(TRI_ERROR_SYS_ERROR);
int res = TRI_errno();
/*int res = */ TRI_errno();
std::string message("write failed for file '" + filename + "': " +
strerror(res));
std::string message("write failed for file '" + filename + "': " + TRI_last_error());
LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "" << message;
THROW_ARANGO_EXCEPTION(TRI_ERROR_SYS_ERROR);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_SYS_ERROR, message);
}
void spit(std::string const& filename, char const* ptr, size_t len, bool sync) {