For wsi socket show errno messages 12/106412/4 accepted/tizen/3.0/common/20161229.113048 accepted/tizen/3.0/ivi/20161229.055556 accepted/tizen/3.0/mobile/20161229.055446 accepted/tizen/3.0/tv/20161229.055513 accepted/tizen/3.0/wearable/20161229.055538 submit/tizen_3.0/20161228.101250 submit/tizen_3.0/20161228.131331
authorAnatolii Nikulin <nikulin.a@samsung.com>
Wed, 21 Dec 2016 12:59:38 +0000 (15:59 +0300)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Mon, 26 Dec 2016 07:56:26 +0000 (23:56 -0800)
Change-Id: Ib9df29ba6b8e1f341dd8298ec723ba2636e6b8fd
Signed-off-by: Anatolii Nikulin <nikulin.a@samsung.com>
daemon/wsi.c

index 6518a06..ce1cbe6 100644 (file)
@@ -439,6 +439,7 @@ static void *handle_ws_responses(void *arg)
        return NULL;
 }
 
+#define ERRNO_BUFLEN           256
 int socket_connect(const char *host, in_port_t port)
 {
        struct hostent *hp;
@@ -454,7 +455,9 @@ int socket_connect(const char *host, in_port_t port)
        addr.sin_family = AF_INET;
        sk = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
        if (sk < 0) {
-               LOGE("failed to open TCP socket\n");
+               char buf[ERRNO_BUFLEN];
+               strerror_r(errno, buf, sizeof(buf));
+               LOGE("failed to open TCP socket: %s(%d)\n", buf, errno);
                return -1;
        }
 
@@ -462,7 +465,9 @@ int socket_connect(const char *host, in_port_t port)
                         (const char *)&on, sizeof(int));
 
        if (ret < 0) {
-               LOGE("failed to set socket option\n");
+               char buf[ERRNO_BUFLEN];
+               strerror_r(errno, buf, sizeof(buf));
+               LOGE("failed to set socket option %s(%d)\n", buf, errno);
                close(sk);
                return -1;
        }
@@ -470,7 +475,9 @@ int socket_connect(const char *host, in_port_t port)
        ret = connect(sk, (struct sockaddr *)&addr,
                      sizeof(struct sockaddr_in));
        if (ret < 0) {
-               LOGE("failed to connect socket\n");
+               char buf[ERRNO_BUFLEN];
+               strerror_r(errno, buf, sizeof(buf));
+               LOGE("failed to connect socket %s(%d)\n", buf, errno);
                close(sk);
                return -1;
        }