From 4f631c67cd90572be1fd6048626745b5647e21ef Mon Sep 17 00:00:00 2001 From: Rafal Walczyna Date: Fri, 6 Apr 2018 09:19:43 +0200 Subject: [PATCH] [Messaging] Fixed permissions of temporary file used for messaging File created by mkstemp() gives permissions only for user, that's why msg-service could not read from file and body of message was empty. [Verification] 100% passrate on TM1 Change-Id: I290277294459ca96392b9a97adccded1664a426d Signed-off-by: Rafal Walczyna --- src/messaging/message.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/messaging/message.cc b/src/messaging/message.cc index ba6aaa6..5fdbbc6 100644 --- a/src/messaging/message.cc +++ b/src/messaging/message.cc @@ -346,6 +346,11 @@ PlatformResult saveToTempFile(const std::string& data, std::string* file_name) { if (-1 == file_descriptor) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Temp file creation failed"); } + // Change permision of file to -rw-r--r-- + int ret_fchmod = fchmod(file_descriptor, 0644); + if (-1 == ret_fchmod) { + return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Permission changing failed"); + } std::string tmp_name = buf; -- 2.7.4