mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-07 18:11:43 +00:00
Allow NULL error message prefix when class=GITERR_OS
This commit is contained in:
parent
59403f1ff5
commit
e62f96dea5
16
src/errors.c
16
src/errors.c
@ -45,15 +45,19 @@ void giterr_set(int error_class, const char *string, ...)
|
|||||||
#endif
|
#endif
|
||||||
int error_code = (error_class == GITERR_OS) ? errno : 0;
|
int error_code = (error_class == GITERR_OS) ? errno : 0;
|
||||||
|
|
||||||
va_start(arglist, string);
|
if (string) {
|
||||||
git_buf_vprintf(&buf, string, arglist);
|
va_start(arglist, string);
|
||||||
va_end(arglist);
|
git_buf_vprintf(&buf, string, arglist);
|
||||||
|
va_end(arglist);
|
||||||
|
|
||||||
|
if (error_class == GITERR_OS)
|
||||||
|
git_buf_PUTS(&buf, ": ");
|
||||||
|
}
|
||||||
|
|
||||||
if (error_class == GITERR_OS) {
|
if (error_class == GITERR_OS) {
|
||||||
#ifdef GIT_WIN32
|
#ifdef GIT_WIN32
|
||||||
char * win32_error = git_win32_get_error_message(win32_error_code);
|
char * win32_error = git_win32_get_error_message(win32_error_code);
|
||||||
if (win32_error) {
|
if (win32_error) {
|
||||||
git_buf_PUTS(&buf, ": ");
|
|
||||||
git_buf_puts(&buf, win32_error);
|
git_buf_puts(&buf, win32_error);
|
||||||
git__free(win32_error);
|
git__free(win32_error);
|
||||||
|
|
||||||
@ -61,10 +65,8 @@ void giterr_set(int error_class, const char *string, ...)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (error_code) {
|
if (error_code)
|
||||||
git_buf_PUTS(&buf, ": ");
|
|
||||||
git_buf_puts(&buf, strerror(error_code));
|
git_buf_puts(&buf, strerror(error_code));
|
||||||
}
|
|
||||||
|
|
||||||
if (error_code)
|
if (error_code)
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user