diff options
Diffstat (limited to 'src/errors.c')
-rw-r--r-- | src/errors.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/errors.c b/src/errors.c index 3aa1757b2..c5f0b3b59 100644 --- a/src/errors.c +++ b/src/errors.c @@ -89,15 +89,16 @@ void giterr_set_str(int error_class, const char *string) int giterr_set_regex(const regex_t *regex, int error_code) { char error_buf[1024]; + + assert(error_code); + regerror(error_code, regex, error_buf, sizeof(error_buf)); giterr_set_str(GITERR_REGEX, error_buf); if (error_code == REG_NOMATCH) return GIT_ENOTFOUND; - else if (error_code > REG_BADPAT) - return GIT_EINVALIDSPEC; - else - return -1; + + return GIT_EINVALIDSPEC; } void giterr_clear(void) |