From 6fa344267fb6b921ddc301d532f00499339e993b Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 6 Aug 2018 07:55:41 +0900 Subject: [PATCH] Use thread-safe function - Uses strerror_r() function Change-Id: I16aeaf313ee0366fdfd8a2c5d7cc8b487cd0032f Signed-off-by: Hwankyu Jhun --- src/launch.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/launch.c b/src/launch.c index 24387fe..ccfc883 100755 --- a/src/launch.c +++ b/src/launch.c @@ -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; } } -- 2.7.4