summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2016-04-08 16:48:45 +1000
committerAlex Gorrod <alexg@wiredtiger.com>2016-04-08 16:48:45 +1000
commit7ea2631de25c4246c83af146bf39fe83cbcb2055 (patch)
treed273ef6f5d5e5692bf5125e1ab6add7242d8f3ff
parent039fe06082ca2d400f6fbe2b534cb6869398d099 (diff)
parent7bcf6fc668657e734c370db349283243492fa010 (diff)
downloadmongo-7ea2631de25c4246c83af146bf39fe83cbcb2055.tar.gz
Merge branch 'mongodb-3.4' into mongodb-3.2
-rw-r--r--src/os_win/os_fs.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/os_win/os_fs.c b/src/os_win/os_fs.c
index 462773cb9fb..95c0ea40ce6 100644
--- a/src/os_win/os_fs.c
+++ b/src/os_win/os_fs.c
@@ -217,20 +217,20 @@ __win_handle_close(WT_SESSION_IMPL *session, WT_FH *fh)
{
WT_DECL_RET;
- if (fh->fp == NULL) {
+ if (fh->filehandle != INVALID_HANDLE_VALUE) {
/*
* We don't open Windows system handles when opening directories
* for flushing, as it is not necessary (or possible) to flush
* a directory on Windows. Confirm the file handle is set before
* attempting to close it.
*/
- if (fh->filehandle != INVALID_HANDLE_VALUE &&
- CloseHandle(fh->filehandle) == 0) {
+ if (CloseHandle(fh->filehandle) == 0) {
ret = __wt_getlasterror();
__wt_err(session, ret,
"%s: handle-close: CloseHandle", fh->name);
}
- } else {
+ }
+ if (fh->fp != NULL) {
/* If the stream was opened for writing, flush the file. */
if (F_ISSET(fh, WT_FH_FLUSH_ON_CLOSE) && fflush(fh->fp) != 0) {
ret = __wt_errno();
@@ -506,7 +506,7 @@ __win_handle_open(WT_SESSION_IMPL *session,
HANDLE filehandle, filehandle_secondary;
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
- int desired_access, f, fd;
+ int desired_access, f;
bool direct_io;
const char *stream_mode;
@@ -628,12 +628,10 @@ __win_handle_open(WT_SESSION_IMPL *session,
break;
}
if (stream_mode != NULL) {
- if ((fd = _open_osfhandle((intptr_t)filehandle, f)) == -1)
+ if ((fh->fp = fopen(name, stream_mode)) == NULL)
WT_ERR_MSG(session, __wt_errno(),
- "%s: handle-open: _open_osfhandle", name);
- if ((fh->fp = fdopen(fd, stream_mode)) == NULL)
- WT_ERR_MSG(session, __wt_errno(),
- "%s: handle-open: fdopen", name);
+ "%s: handle-open: fopen", name);
+
if (LF_ISSET(WT_STREAM_LINE_BUFFER))
__wt_stream_set_line_buffer(fh->fp);
}