diff options
Diffstat (limited to 'src/os_win/os_errno.c')
-rw-r--r-- | src/os_win/os_errno.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/os_win/os_errno.c b/src/os_win/os_errno.c new file mode 100644 index 00000000000..23d006cac85 --- /dev/null +++ b/src/os_win/os_errno.c @@ -0,0 +1,27 @@ +/*- + * Copyright (c) 2008-2014 WiredTiger, Inc. + * All rights reserved. + * + * See the file LICENSE for redistribution information. + */ + +#include "wt_internal.h" + +/* + * __wt_errno -- + * Return errno, or WT_ERROR if errno not set. + */ +int +__wt_errno(void) +{ + /* + * Called when we know an error occurred, and we want the system + * error code, but there's some chance it's not set. + */ + DWORD err = GetLastError(); + + /* GLE should only be called if we hit an actual error */ + WT_ASSERT(NULL, err != ERROR_SUCCESS); + + return (err == ERROR_SUCCESS ? WT_ERROR : err); +} |