Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-11-02 21:42:20 +0400
committerRussell Belfer <rb@github.com>2012-11-02 21:42:20 +0400
commit3ae0aad75a035956e1e35bff226edbf541f17835 (patch)
treed988ffc73996644b40ebcbd88d13d94bd0e65dfc /src/errors.c
parent1362a983165abb5e85e66c2b0474157ba697966a (diff)
Move error capture to top of giterr_set
Diffstat (limited to 'src/errors.c')
-rw-r--r--src/errors.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/errors.c b/src/errors.c
index 9aad5f05e..ac7fa934d 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -40,17 +40,17 @@ void giterr_set(int error_class, const char *string, ...)
{
git_buf buf = GIT_BUF_INIT;
va_list arglist;
+#ifdef GIT_WIN32
+ DWORD win32_error_code = (error_class == GITERR_OS) ? GetLastError() : 0;
+#endif
+ int error_code = (error_class == GITERR_OS) ? errno : 0;
va_start(arglist, string);
git_buf_vprintf(&buf, string, arglist);
va_end(arglist);
if (error_class == GITERR_OS) {
- int error_code = errno;
-
#ifdef GIT_WIN32
- DWORD win32_error_code = GetLastError();
-
if (win32_error_code) {
char *lpMsgBuf;