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)
committerJengHyun Kang <jhyuni.kang@samsung.com>
Tue, 24 Oct 2017 07:04:33 +0000 (16:04 +0900)
Change-Id: Iacd31adb29bb284f93aa04597d5c6ca364e0616b

src/evdev.c

index 9d5e030e475c92c214537df4f2978a22e9b0eb98..4190122b023b22b33a4ff83a7db8691e26279a7a 100644 (file)
@@ -3054,6 +3054,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;
@@ -3061,6 +3062,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, };
 
        /* Use non-blocking mode so that we can loop on read on
         * evdev_device_data() until all events on the fd are
@@ -3072,7 +3074,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;
        }