Blob Blame History Raw
From 4d0f8ba66ba170e6e983ff467b79c66707dbe600 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Thu, 5 Dec 2019 10:53:22 +0100
Subject: [PATCH 098/181] print: Fix match error propagation

The FPI_MATCH_ERROR constant was set to 0, however it is propagated to
the task completion using g_task_propagate_int. As g_task_propagate_int
will always return -1 on error, we either need to add an explicit -1
check or we just need to match the semantics.

Change the constant to -1, also rearange FP_MATCH_SUCCESS so that it
does not end up being 0.
---
 libfprint/fpi-print.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libfprint/fpi-print.h b/libfprint/fpi-print.h
index 94670a0..04500d6 100644
--- a/libfprint/fpi-print.h
+++ b/libfprint/fpi-print.h
@@ -21,13 +21,13 @@ typedef enum {
 /**
  * FpiMatchResult:
  * @FPI_MATCH_ERROR: An error occured during matching
- * @FPI_MATCH_SUCCESS: The prints matched
  * @FPI_MATCH_FAIL: The prints did not match
+ * @FPI_MATCH_SUCCESS: The prints matched
  */
 typedef enum {
-  FPI_MATCH_ERROR = 0,
-  FPI_MATCH_SUCCESS,
+  FPI_MATCH_ERROR = -1, /* -1 for g_task_propagate_int */
   FPI_MATCH_FAIL,
+  FPI_MATCH_SUCCESS,
 } FpiMatchResult;
 
 void     fpi_print_add_print (FpPrint *print,
-- 
2.24.1