[PATCH evemu] Rewind the fp to the beginning of the first event line

Peter Hutterer peter.hutterer at who-t.net
Wed Jul 29 16:22:26 PDT 2015


On Wed, Jul 29, 2015 at 07:13:27PM -0400, Benjamin Tissoires wrote:
> On Mon, Jul 27, 2015 at 10:35 PM, Peter Hutterer
> <peter.hutterer at who-t.net> wrote:
> > evemu_read reads lines until they start with E:, i.e. the first event line.
> > evemu_read_event then contines from that position. This causes us to miss the
> > first event.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> 
> Oh, that was a nasty one. Thanks for spotting it.
> 
> I have now pushed both patches (the delta timestamps and this one):
>    79b29f0..17f901f  master -> master
> 
> I'll probably do a release of v2.2 tomorrow so distributions will get
> access to the new features/comments :)

for the archives:
this bug was found using the python bindings, it's not reproducible with
evemu-device/evemu-play because as two processes they have their own fd. The
python bindings read the whole file in at once through the same fd, that's
how the bug was triggered.

Cheers,
   Peter

> >  src/evemu.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/src/evemu.c b/src/evemu.c
> > index 8b149b0..19a372b 100644
> > --- a/src/evemu.c
> > +++ b/src/evemu.c
> > @@ -691,6 +691,8 @@ int evemu_read(struct evemu_device *dev, FILE *fp)
> >
> >         rc = 1;
> >
> > +       fseek(fp, -strlen(line), SEEK_CUR);
> > +
> >  out:
> >         free(line);
> >         return rc;
> > --
> > 2.4.3
> >
> > _______________________________________________
> > Input-tools mailing list
> > Input-tools at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/input-tools


More information about the Input-tools mailing list