Fix error checking for socket fd 77/150777/4 accepted/tizen/4.0/unified/20171011.150507 accepted/tizen/unified/20171011.150601 submit/tizen/20171011.101248 submit/tizen_4.0/20171011.101309 tizen_4.0.IoT.p1_release
authorakoszewski <a.koszewski@samsung.com>
Mon, 18 Sep 2017 12:22:45 +0000 (14:22 +0200)
committerLukasz Kostyra <l.kostyra@samsung.com>
Wed, 11 Oct 2017 08:06:12 +0000 (10:06 +0200)
This is needed for cases when socket fd is equal to 0

Change-Id: Idb5926594f47cfad21fb8c6cc36a3b815ef667a0

TEECLib/src/teec_connection.c
ssflib/src/ssf_client.cpp

index 889ee82..af623ea 100644 (file)
@@ -116,7 +116,7 @@ static uint32_t sendCommandtoDaemon(int32_t sockfd, char* fdata, size_t size) {
        ssize_t nwrite = 0;
        size_t nbytes = 0;
 
-       if (sockfd > 0) {
+       if (sockfd >= 0) {
                // send size number of bytes to Simulator Daemon
                do {
                        nwrite = send(sockfd, fdata + nbytes, size - nbytes, 0);
@@ -145,7 +145,7 @@ static uint32_t receiveResponse(int32_t sockfd, char* fdata, size_t size) {
        ssize_t nread = 0;
        size_t nbytes = 0;
 
-       if (sockfd > 0) {
+       if (sockfd >= 0) {
                // receive size number of bytes to Simulator Daemon
                do {
                        nread = recv(sockfd, fdata + nbytes, size - nbytes, 0);
index 14b7f8d..00b07e4 100644 (file)
@@ -101,7 +101,7 @@ static uint32_t sendCommandtoDaemon(int32_t sockfd, char* fdata, size_t size) {
        LOGD(SSF_LIB, "Entry");
        ssize_t nwrite = 0;
        size_t nbytes = 0;
-       if (sockfd > 0) {
+       if (sockfd >= 0) {
                do {
                        nwrite = send(sockfd, fdata + nbytes, size - nbytes, 0);
                } while ((nwrite == -1 && errno == EINTR) || (nwrite > 0 && ((nbytes +=
@@ -124,7 +124,7 @@ static uint32_t receiveResponse(int32_t sockfd, char* fdata, size_t size) {
        LOGD(SSF_LIB, "Entry");
        ssize_t nread = 0;
        size_t nbytes = 0;
-       if (sockfd > 0) {
+       if (sockfd >= 0) {
                do {
                        nread = recv(sockfd, fdata + nbytes, size - nbytes, 0);
                } while ((nread == -1 && errno == EINTR)