summaryrefslogtreecommitdiff
path: root/src/errors.c
diff options
context:
space:
mode:
authorPhilip Kelley <phkelley@hotmail.com>2013-02-22 12:23:14 -0500
committerPhilip Kelley <phkelley@hotmail.com>2013-02-22 12:23:14 -0500
commit6c72035fbc9688d52ccee47f3efb24913fc20af9 (patch)
treed623eacd87c286618387ebb6206445c1942019d3 /src/errors.c
parent0309e85045bfb143c172b3342293d98d687e8092 (diff)
downloadlibgit2-6c72035fbc9688d52ccee47f3efb24913fc20af9.tar.gz
Portability fixes for Solaris
Diffstat (limited to 'src/errors.c')
-rw-r--r--src/errors.c9
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)