From b1f8ea0a5ef26ed462e1d33cee044963b6e55f13 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 25 Jan 2021 16:30:22 +1000 Subject: [PATCH] tools/record: narrow the scope of two variables Signed-off-by: Peter Hutterer --- tools/libinput-record.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/libinput-record.c b/tools/libinput-record.c index b9f8f13a..73567508 100644 --- a/tools/libinput-record.c +++ b/tools/libinput-record.c @@ -2117,8 +2117,6 @@ mainloop(struct record_context *ctx) struct pollfd fds[ctx->ndevices + 2]; unsigned int nfds = 0; struct record_device *d = NULL; - struct record_device *first_device = NULL; - struct timespec ts; sigset_t mask; assert(ctx->timeout != 0); @@ -2157,6 +2155,8 @@ mainloop(struct record_context *ctx) * start time. Otherwise, the first event starts the recording time. */ if (ctx->ndevices > 1) { + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); ctx->offset = s2us(ts.tv_sec) + ns2us(ts.tv_nsec); } @@ -2164,6 +2164,7 @@ mainloop(struct record_context *ctx) do { int rc; bool had_events = false; /* we delete files without events */ + struct record_device *first_device = NULL; if (!open_output_file(ctx, autorestart)) { fprintf(stderr,