summaryrefslogtreecommitdiff
path: root/src/errors.c
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-02-23 03:39:11 -0800
committerVicent Martí <vicent@github.com>2013-02-23 03:39:11 -0800
commit5eeb357df806a60664f61bf1238a21a402732c44 (patch)
tree2c738d40a29477f6fd5ac477e76be292ff2b4be9 /src/errors.c
parent68fec637a24fa60497e458155432c76327b60653 (diff)
parent6c72035fbc9688d52ccee47f3efb24913fc20af9 (diff)
downloadlibgit2-5eeb357df806a60664f61bf1238a21a402732c44.tar.gz
Merge pull request #1355 from phkelley/development
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)