From: Sung-Jin Park Date: Thu, 5 Mar 2020 03:48:53 +0000 (+0900) Subject: replace strerr*() functions with %m format for thread-safety X-Git-Tag: accepted/tizen/unified/20200305.123258^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3d6e8533da9d9da77d781de6c8694961b18d0a5;p=platform%2Fcore%2Fuifw%2Fpepper.git replace strerr*() functions with %m format for thread-safety Change-Id: Ie75f6f325edbaab71d33743e21bdd7b8ea757fc6 Signed-off-by: Sung-Jin Park --- diff --git a/src/lib/evdev/evdev.c b/src/lib/evdev/evdev.c index f88d6d9..a348ff9 100644 --- a/src/lib/evdev/evdev.c +++ b/src/lib/evdev/evdev.c @@ -123,7 +123,6 @@ _evdev_keyboard_event_fd_read(int fd, uint32_t mask, void *data) { uint32_t i; int nread; - char buf[128]; struct input_event ev[EVENT_MAX]; evdev_device_info_t *device_info = (evdev_device_info_t *)data; @@ -136,8 +135,8 @@ _evdev_keyboard_event_fd_read(int fd, uint32_t mask, void *data) return 0; nread = read(fd, &ev, sizeof(ev)); - PEPPER_CHECK(nread>=0, return 0, "[%s] Failed on reading given fd. (error : %s, fd:%d)\n", - __FUNCTION__, strerror_r(errno, buf, 128), fd); + PEPPER_CHECK(nread>=0, return 0, "[%s] Failed on reading given fd. (error msg : %m, fd:%d)\n", + __FUNCTION__, fd); for (i = 0 ; i < (nread / sizeof(ev[0])); i++) { diff --git a/src/lib/inotify/pepper-inotify.c b/src/lib/inotify/pepper-inotify.c index dbc9f3f..cf11875 100644 --- a/src/lib/inotify/pepper-inotify.c +++ b/src/lib/inotify/pepper-inotify.c @@ -78,7 +78,6 @@ _inotify_fd_read(int fd, uint32_t mask, void *data) { uint32_t i; int nread; - char buf[128]; struct inotify_event ev[32]; pepper_inotify_watch_t *watch_data = data; @@ -92,8 +91,7 @@ _inotify_fd_read(int fd, uint32_t mask, void *data) nread = read(fd, &ev, sizeof(ev)); PEPPER_CHECK(nread >= 0, return 0, - "Failed on reading given fd. (error : %s, fd:%d)\n", - strerror_r(errno, buf, 128), fd); + "Failed on reading given fd. (error msg : %m, fd:%d)\n", fd); for (i = 0 ; i < (nread / sizeof(ev[0])); i++) { if (ev[i].wd == watch_data->wd) @@ -134,7 +132,6 @@ PEPPER_API pepper_bool_t pepper_inotify_add(pepper_inotify_t *inotify, const char *path) { pepper_inotify_watch_t *watch_data; - char buf[128]; PEPPER_CHECK(inotify, return PEPPER_FALSE, "Invalid pepper_inotify_t object\n"); PEPPER_CHECK(path, return PEPPER_FALSE, "Invalid path\n"); @@ -148,7 +145,7 @@ pepper_inotify_add(pepper_inotify_t *inotify, const char *path) watch_data->wd = inotify_add_watch(inotify->fd, path, IN_MODIFY | IN_CREATE | IN_DELETE | IN_MOVED_FROM | IN_MOVED_TO | IN_MOVE_SELF); PEPPER_CHECK(watch_data->wd >= 0, goto failed, - "Failed to add watch for %s\n", path, strerror_r(errno, buf, 128)); + "Failed to add watch for %s (error msg:%m)\n", path); strncpy(watch_data->path, path, MAX_PATH_LEN - 1); diff --git a/src/lib/keyrouter/pepper-keyrouter.c b/src/lib/keyrouter/pepper-keyrouter.c index 851073a..f648f55 100644 --- a/src/lib/keyrouter/pepper-keyrouter.c +++ b/src/lib/keyrouter/pepper-keyrouter.c @@ -675,7 +675,7 @@ _pepper_keyrouter_options_set(pepper_keyrouter_t *pepper_keyrouter) PEPPER_CHECK(pepper_keyrouter->opts, return, "Failed to alloc memory for options\n") ; file = fopen(KEYLAYOUT_DIR, "r"); - PEPPER_CHECK(file, goto finish, "Failed to open key layout file(%s): (errno: %s)\n", KEYLAYOUT_DIR, strerror(errno)); + PEPPER_CHECK(file, goto finish, "Failed to open key layout file(%s): (err msg: %m)\n", KEYLAYOUT_DIR); while (!feof(file)) { ret = fgets(buf, 1024, file);