From: Rafal Walczyna Date: Fri, 6 Apr 2018 07:19:43 +0000 (+0200) Subject: [Messaging] Fixed permissions of temporary file used for messaging X-Git-Tag: submit/tizen/20180406.100350^2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f631c67cd90572be1fd6048626745b5647e21ef;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [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 --- diff --git a/src/messaging/message.cc b/src/messaging/message.cc index ba6aaa6f..5fdbbc6e 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;