From 056ea541ddc97f5806cffbd99a12dc87e4da3546 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 26 Jun 2018 14:52:26 +0200
Subject: [PATCH] poll: Fix fp_get_pollfds retval type

fp_get_pollfds() is supposed to return a negative value on failure, but
size_t is an unsigned integer. Use ssize_t instead.
---
 libfprint/fprint.h | 2 +-
 libfprint/poll.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libfprint/fprint.h b/libfprint/fprint.h
index c927690..be94a54 100644
--- a/libfprint/fprint.h
+++ b/libfprint/fprint.h
@@ -314,7 +314,7 @@ struct fp_pollfd {
 
 int fp_handle_events_timeout(struct timeval *timeout);
 int fp_handle_events(void);
-size_t fp_get_pollfds(struct fp_pollfd **pollfds);
+ssize_t fp_get_pollfds(struct fp_pollfd **pollfds);
 int fp_get_next_timeout(struct timeval *tv);
 
 /**
diff --git a/libfprint/poll.c b/libfprint/poll.c
index 8a007bc..615ba40 100644
--- a/libfprint/poll.c
+++ b/libfprint/poll.c
@@ -313,12 +313,12 @@ API_EXPORTED int fp_get_next_timeout(struct timeval *tv)
  *
  * Returns: the number of pollfds in the resultant list, or negative on error.
  */
-API_EXPORTED size_t fp_get_pollfds(struct fp_pollfd **pollfds)
+API_EXPORTED ssize_t fp_get_pollfds(struct fp_pollfd **pollfds)
 {
 	const struct libusb_pollfd **usbfds;
 	const struct libusb_pollfd *usbfd;
 	struct fp_pollfd *ret;
-	size_t cnt = 0;
+	ssize_t cnt = 0;
 	size_t i = 0;
 
 	usbfds = libusb_get_pollfds(fpi_usb_ctx);