From f5f561424a317f30d2b9b8911d701c5093ddaf49 Mon Sep 17 00:00:00 2001
From: Ian Douglas Scott <ian@iandouglasscott.com>
Date: Sun, 25 Nov 2018 21:24:32 -0800
Subject: [PATCH] Correct return value of regerror

---
 src/header/regex/mod.rs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/header/regex/mod.rs b/src/header/regex/mod.rs
index 30c83724..79e9c411 100644
--- a/src/header/regex/mod.rs
+++ b/src/header/regex/mod.rs
@@ -149,7 +149,7 @@ pub extern "C" fn regexec(
 
 #[no_mangle]
 #[linkage = "weak"] // redefined in GIT
-pub extern "C" fn regerror(code: c_int, _regex: *const regex_t, out: *mut c_char, max: size_t) {
+pub extern "C" fn regerror(code: c_int, _regex: *const regex_t, out: *mut c_char, max: size_t) -> size_t {
     let string = match code {
         0 => "No error\0",
         REG_NOMATCH => "No match\0",
@@ -174,6 +174,8 @@ pub extern "C" fn regerror(code: c_int, _regex: *const regex_t, out: *mut c_char
             string.as_ptr(),
             out as *mut u8,
             string.len().min(max as usize),
-        )
+        );
     }
+
+    string.len()
 }
-- 
GitLab