From: Lukasz Bardeli Date: Mon, 26 Nov 2018 09:49:53 +0000 (+0100) Subject: [Archive] Fix for preventing errno overwriting X-Git-Tag: accepted/tizen/5.0/unified/20181127.073210~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F79%2F193779%2F2;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Archive] Fix for preventing errno overwriting Sometimes errno was overwritten and in switch return different values that was assigned in lstat. This caused issue in throwing errors (IO instead Not Found) [Verification] Code compiles without error. TCT passrate 100% Change-Id: I79fc23cdd4c9113cab56d42cee6b5df82ed632a1 Signed-off-by: Lukasz Bardeli --- diff --git a/src/archive/filesystem_node.cc b/src/archive/filesystem_node.cc index 9ba9400..1d8048c 100644 --- a/src/archive/filesystem_node.cc +++ b/src/archive/filesystem_node.cc @@ -115,9 +115,10 @@ PlatformResult Node::resolve(const PathPtr& path, NodePtr* node) { struct stat syminfo; if (lstat(path->getFullPath().c_str(), &info) != 0) { - LoggerE("File:[%s] error no:%d", path->getFullPath().c_str(), errno); + int tmp_errno = errno; + LoggerE("File: [%s] error no: %d", path->getFullPath().c_str(), tmp_errno); - switch (errno) { + switch (tmp_errno) { case EACCES: SLoggerE("File: [%s]", path->getFullPath().c_str()); return LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR, "Node access denied");