diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-11-19 22:00:46 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-12-01 11:34:31 +0400 |
commit | cc1466264a385419aa4ebc3811846b038b3430d1 (patch) | |
tree | d3d9a6da47a845044a9c5b39f6b4920bd15b2740 /src/errors.c | |
parent | 84166facc9537a03d8aaaa415c9e8044d0239252 (diff) |
revparse: Deploy EINVALIDSPEC usage
Diffstat (limited to 'src/errors.c')
-rw-r--r-- | src/errors.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/errors.c b/src/errors.c index ac7fa934d..e62507216 100644 --- a/src/errors.c +++ b/src/errors.c @@ -93,11 +93,18 @@ void giterr_set_str(int error_class, const char *string) set_error(error_class, message); } -void giterr_set_regex(const regex_t *regex, int error_code) +int giterr_set_regex(const regex_t *regex, int error_code) { char error_buf[1024]; 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; } void giterr_clear(void) |