[PATCH evemu] Only overwrite NULL names on evemu_read()

Benjamin Tissoires benjamin.tissoires at gmail.com
Tue Nov 12 07:21:24 PST 2013


On Tue, Nov 12, 2013 at 12:08 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> If a caller has provided a device name to evemu_new(), parse the name but
> don't copy it in to the device struct.

Well, the problem I see is that it will change default behavior when
using evemu-device:
evemu-device used to use the name provided in the description file,
but now, it will get some un-readable names "evemu-N"m N being the PID
of the evemu-device process.
It's not a problem for automated test suites, but it is when you want
to manually compare to evemu outputs.

Cheers,
Benjamin


>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/evemu.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/evemu.c b/src/evemu.c
> index 3d88c8d..ff498d2 100644
> --- a/src/evemu.c
> +++ b/src/evemu.c
> @@ -421,8 +421,10 @@ static int parse_name(struct evemu_device *dev, const char *line, struct version
>         int matched;
>         char *devname = NULL;
>
> -       if ((matched = sscanf(line, "N: %m[^\n]\n", &devname)) > 0)
> -               evemu_set_name(dev, devname);
> +       if ((matched = sscanf(line, "N: %m[^\n]\n", &devname)) > 0) {
> +               if (strlen(dev->name) == 0)
> +                       evemu_set_name(dev, devname);
> +       }
>
>         if (devname != NULL)
>                 free(devname);
> --
> 1.8.3.1
>


More information about the Input-tools mailing list