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)
committerduna.oh <duna.oh@samsung.com>
Fri, 27 Jan 2023 05:06:43 +0000 (14:06 +0900)
Change-Id: Iacd31adb29bb284f93aa04597d5c6ca364e0616b

src/evdev.c

index d299230..9e18161 100644 (file)
@@ -2436,6 +2436,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;
@@ -2443,6 +2444,7 @@ evdev_device_create(struct libinput_seat *seat,
        int unhandled_device = 0;
        const char *devnode = udev_device_get_devnode(udev_device);
        char *sysname = str_sanitize(udev_device_get_sysname(udev_device));
+       char buf[STRERR_BUFSIZE] = {0, };
 
        if (!devnode) {
                log_info(libinput, "%s: no device node associated\n", sysname);
@@ -2464,7 +2466,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));
                goto err;
        }