summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>2019-07-25 16:25:06 +0200
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>2019-07-25 16:25:06 +0200
commit036358c5fa63c18a9cd6ddd3b499401bd2515416 (patch)
treef386db66454354a43f6c6e3b9602e2ef01dbd0c6
parentb0f045ff228b5193e67060e6c698f3ba7fc08c58 (diff)
downloadtef-simulator-036358c5fa63c18a9cd6ddd3b499401bd2515416.tar.gz
tef-simulator-036358c5fa63c18a9cd6ddd3b499401bd2515416.tar.bz2
tef-simulator-036358c5fa63c18a9cd6ddd3b499401bd2515416.zip
Store errno in a variable to avoid overwriting
Errno code from connect() was overwritten by the result of close(). As a result the EACCES condition was not triggered. Change-Id: I95478d28ce72b5535f98d4b045d3f8e0eec92306
-rw-r--r--TEECLib/src/teec_connection.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/TEECLib/src/teec_connection.c b/TEECLib/src/teec_connection.c
index 7ae18cc..ddf6279 100644
--- a/TEECLib/src/teec_connection.c
+++ b/TEECLib/src/teec_connection.c
@@ -73,9 +73,10 @@ TEEC_Result connectToServer(int32_t *fd)
// Connect to Simulator Daemon
if (connect(serverSocket, sockptr, socklen) == -1) {
- LOGE(MODULE_TEEC_LIB, "connection to simdaemon(%s) failed errno=%d", SIMDAEMON_SOCK_PATH, errno);
+ int err = errno;
+ LOGE(MODULE_TEEC_LIB, "connection to simdaemon(%s) failed errno=%d", SIMDAEMON_SOCK_PATH, err);
close(serverSocket);
- if (errno == EACCES)
+ if (err == EACCES)
return TEEC_ERROR_ACCESS_DENIED;
return TEEC_ERROR_GENERIC;
}