svace: Modify a strerror function to strerror_r to gurantee threads safety.
authorJengHyun Kang <jhyuni.kang@samsung.com>
Tue, 12 Jul 2016 02:14:03 +0000 (11:14 +0900)
committerjeon <jhyuni.kang@samsung.com>
Tue, 5 Jan 2021 10:37:53 +0000 (19:37 +0900)
Change-Id: Iacd31adb29bb284f93aa04597d5c6ca364e0616b

src/evdev.c

index 0877c429632f86fd9776a8e0408531ebfdd7a744..9931b3ee9dcc06315462345a20e38e68e21c522c 100644 (file)
@@ -2207,6 +2207,7 @@ struct evdev_device *
 evdev_device_create(struct libinput_seat *seat,
                    struct udev_device *udev_device)
 {
+#define STRERR_BUFSIZE 256
        struct libinput *libinput = seat->libinput;
        struct evdev_device *device = NULL;
        int rc;
@@ -2214,6 +2215,7 @@ evdev_device_create(struct libinput_seat *seat,
        int unhandled_device = 0;
        const char *devnode = udev_device_get_devnode(udev_device);
        const char *sysname = udev_device_get_sysname(udev_device);
+       char buf[STRERR_BUFSIZE] = {0, };
 
        if (!devnode) {
                log_info(libinput, "%s: no device node associated\n", sysname);
@@ -2235,7 +2237,7 @@ evdev_device_create(struct libinput_seat *seat,
                         "%s: opening input device '%s' failed (%s).\n",
                         sysname,
                         devnode,
-                        strerror(-fd));
+                        strerror_r(-fd, buf, STRERR_BUFSIZE));
                return NULL;
        }