[Archive] Fix for preventing errno overwriting 79/193779/2
authorLukasz Bardeli <l.bardeli@AMDC967.digital.local>
Mon, 26 Nov 2018 09:49:53 +0000 (10:49 +0100)
committerLukasz Bardeli <l.bardeli@AMDC967.digital.local>
Mon, 26 Nov 2018 09:49:53 +0000 (10:49 +0100)
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 <l.bardeli@AMDC967.digital.local>
src/archive/filesystem_node.cc

index 9ba9400..1d8048c 100644 (file)
@@ -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");