From 3dd905d4e92962a970b877285fa6f39ed997a2ea Mon Sep 17 00:00:00 2001 From: Sergio Cerlesi Date: Wed, 16 Feb 2011 09:34:55 +0100 Subject: [PATCH] Fix return timeout of fp_get_next_timeout On function fp_get_next_timeout if exist fprint timeout or libusb timeout the function return the smaller of they. But if one of that not exist and have a smaller value the function return a timeout that not exist. --- libfprint/poll.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libfprint/poll.c b/libfprint/poll.c index f78b658..e849ea4 100644 --- a/libfprint/poll.c +++ b/libfprint/poll.c @@ -270,6 +270,14 @@ API_EXPORTED int fp_get_next_timeout(struct timeval *tv) if (r_fprint == 0 && r_libusb == 0) return 0; + /* if fprint have no pending timeouts return libusb timeout */ + else if (r_fprint == 0) + *tv = libusb_timeout; + + /* if libusb have no pending timeouts return fprint timeout */ + else if (r_libusb == 0) + *tv = fprint_timeout; + /* otherwise return the smaller of the 2 timeouts */ else if (timercmp(&fprint_timeout, &libusb_timeout, <)) *tv = fprint_timeout;