Use thread-safe function 56/185956/2
authorHwankyu Jhun <h.jhun@samsung.com>
Sun, 5 Aug 2018 22:55:41 +0000 (07:55 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Mon, 6 Aug 2018 00:03:50 +0000 (00:03 +0000)
- Uses strerror_r() function

Change-Id: I16aeaf313ee0366fdfd8a2c5d7cc8b487cd0032f
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/launch.c

index 24387fe..ccfc883 100755 (executable)
@@ -194,6 +194,7 @@ API int app_send_cmd_to_launchpad(const char *pad_type, uid_t uid, int cmd, bund
        int fd;
        int len;
        int res;
+       char buf[1024];
 
        fd = aul_sock_create_launchpad_client(pad_type, uid);
        if (fd < 0)
@@ -210,13 +211,19 @@ retry_recv:
        len = recv(fd, &res, sizeof(int), 0);
        if (len == -1) {
                if (errno == EAGAIN) {
-                       _E("recv timeout: %s", strerror(errno));
+                       _E("recv timeout: %d(%s)",
+                                       errno,
+                                       strerror_r(errno, buf, sizeof(buf)));
                        res = -EAGAIN;
                } else if (errno == EINTR) {
-                       _D("recv: %s", strerror(errno));
+                       _D("recv: %d(%s)",
+                                       errno,
+                                       strerror_r(errno, buf, sizeof(buf)));
                        goto retry_recv;
                } else {
-                       _E("recv error: %s", strerror(errno));
+                       _E("recv error: %d(%s)",
+                                       errno,
+                                       strerror_r(errno, buf, sizeof(buf)));
                        res = -ECOMM;
                }
        }