diff --git a/server/Makefile b/server/Makefile index 3fc5032..3b404c8 100644 --- a/server/Makefile +++ b/server/Makefile @@ -1,7 +1,7 @@ BUILD_ON=$(shell uname) BUILD_FOR=$(BUILD_ON) -CXX = c++ -std=c++11 -Wall -O0 -g -fstack-protector-all +CXX = c++ -std=c++11 -Wall -O3 -g -fstack-protector-all ifeq ($(BUILD_ON),Darwin) ifeq ($(BUILD_FOR),Darwin) diff --git a/server/json_rpc.hh b/server/json_rpc.hh index 4654280..d178f77 100644 --- a/server/json_rpc.hh +++ b/server/json_rpc.hh @@ -24,7 +24,7 @@ enum class JSON_RPC js::Object call(const FunctionMap& fm, const js::Object& request, Context* context); // create a JSON-RPC 2.0 compatible result response object -js::Object make_result(const js::Value& result, int id); +//js::Object make_result(const js::Value& result, int id); // create a JSON-RPC 2.0 compatible error response object js::Object make_error(JSON_RPC error_code, const std::string& error_message, const js::Value& data, int id); diff --git a/server/security-token.cc b/server/security-token.cc index 00858fe..63c3401 100644 --- a/server/security-token.cc +++ b/server/security-token.cc @@ -65,7 +65,11 @@ std::string create_security_token(const std::string& server_address, unsigned po o.emplace_back("security_token", sec_token ); const std::string content = js::write( o, js::pretty_print | js::raw_utf8 ) + '\n'; - write(fd, content.data(), content.size()); + const ssize_t ss = write(fd, content.data(), content.size()); + if(ss<0 || uint64_t(ss)!=content.size()) + { + throw std::runtime_error("Cannot write into security token file \"" + filename + "\": " + std::to_string(errno)); + } close(fd); return sec_token;