summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2014-10-13 18:42:55 -0400
committerKeith Bostic <keith@wiredtiger.com>2014-10-13 19:59:57 -0400
commitad6d123b6c32dfb58b4719ff3e2a592d4d26ae0d (patch)
treedbe55de80e65d6560ec724783153593064f86395
parent1dab5e53656560e55a15f8e0daf53fb907c8d791 (diff)
downloadmongo-ad6d123b6c32dfb58b4719ff3e2a592d4d26ae0d.tar.gz
Rename functions, and fix error handling
-rw-r--r--src/include/os.h2
-rw-r--r--src/os_win/os_fallocate.c4
-rw-r--r--src/os_win/os_ftruncate.c4
-rw-r--r--src/os_win/os_open.c13
4 files changed, 14 insertions, 9 deletions
diff --git a/src/include/os.h b/src/include/os.h
index a15ec56e919..a5b5afbd02c 100644
--- a/src/include/os.h
+++ b/src/include/os.h
@@ -52,7 +52,7 @@ struct __wt_fh {
int fd; /* POSIX file handle */
#else
HANDLE filehandle; /* Windows file handle */
- HANDLE filehandletrunc; /* Windows file handle
+ HANDLE filehandle_secondary; /* Windows file handle
for truncation */
#endif
wt_off_t size; /* File size */
diff --git a/src/os_win/os_fallocate.c b/src/os_win/os_fallocate.c
index 17a77d2db98..8cb33e2c1ee 100644
--- a/src/os_win/os_fallocate.c
+++ b/src/os_win/os_fallocate.c
@@ -47,11 +47,11 @@ __wt_fallocate(
largeint.QuadPart = offset + len;
if ((ret = SetFilePointerEx(
- fh->filehandletrunc, largeint, NULL, FILE_BEGIN)) == FALSE)
+ fh->filehandle_secondary, largeint, NULL, FILE_BEGIN)) == FALSE)
WT_RET_MSG(session,
__wt_errno(), "%s SetFilePointerEx error", fh->name);
- if ((ret = SetEndOfFile(fh->filehandletrunc)) != FALSE) {
+ if ((ret = SetEndOfFile(fh->filehandle_secondary)) != FALSE) {
fh->size = fh->extend_size = len;
return (0);
}
diff --git a/src/os_win/os_ftruncate.c b/src/os_win/os_ftruncate.c
index c80400977e0..5d87f1ce06a 100644
--- a/src/os_win/os_ftruncate.c
+++ b/src/os_win/os_ftruncate.c
@@ -21,11 +21,11 @@ __wt_ftruncate(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t len)
largeint.QuadPart = len;
if ((ret = SetFilePointerEx(
- fh->filehandletrunc, largeint, NULL, FILE_BEGIN)) == FALSE)
+ fh->filehandle_secondary, largeint, NULL, FILE_BEGIN)) == FALSE)
WT_RET_MSG(session, __wt_errno(), "%s SetFilePointerEx error",
fh->name);
- ret = SetEndOfFile(fh->filehandletrunc);
+ ret = SetEndOfFile(fh->filehandle_secondary);
if (ret != FALSE) {
fh->size = fh->extend_size = len;
return (0);
diff --git a/src/os_win/os_open.c b/src/os_win/os_open.c
index 1280f5d4017..1e6b4852e42 100644
--- a/src/os_win/os_open.c
+++ b/src/os_win/os_open.c
@@ -35,12 +35,13 @@ __wt_open(WT_SESSION_IMPL *session,
DWORD dwCreationDisposition;
char *path;
HANDLE filehandle;
- HANDLE filehandletrunc;
+ HANDLE filehandle_secondary;
conn = S2C(session);
fh = NULL;
path = NULL;
filehandle = INVALID_HANDLE_VALUE;
+ filehandle_secondary = INVALID_HANDLE_VALUE;
WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, "%s: open", name));
@@ -127,13 +128,15 @@ __wt_open(WT_SESSION_IMPL *session,
* concurrently with reads on the file. Writes would also move the file
* pointer.
*/
- filehandletrunc = CreateFile(path,
+ filehandle_secondary = CreateFile(path,
(GENERIC_READ | GENERIC_WRITE),
share_mode,
NULL,
OPEN_EXISTING,
f,
NULL);
+ WT_ERR_MSG(session, __wt_errno(),
+ "open failed for secondary handle: %s", path);
if (F_ISSET(conn, WT_CONN_CKPT_SYNC))
WT_ERR(__open_directory_sync(session, path));
@@ -141,7 +144,7 @@ __wt_open(WT_SESSION_IMPL *session,
WT_ERR(__wt_calloc(session, 1, sizeof(WT_FH), &fh));
WT_ERR(__wt_strdup(session, name, &fh->name));
fh->filehandle = filehandle;
- fh->filehandletrunc = filehandletrunc;
+ fh->filehandle_secondary = filehandle_secondary;
fh->ref = 1;
fh->direct_io = direct_io;
@@ -183,6 +186,8 @@ err: if (fh != NULL) {
}
if (filehandle != INVALID_HANDLE_VALUE)
(void)CloseHandle(filehandle);
+ if (filehandle != INVALID_HANDLE_VALUE)
+ (void)CloseHandle(filehandle_secondary);
}
__wt_free(session, path);
@@ -219,7 +224,7 @@ __wt_close(WT_SESSION_IMPL *session, WT_FH *fh)
__wt_err(session, ret, "%s", fh->name);
}
- if (!CloseHandle(fh->filehandletrunc) != 0) {
+ if (!CloseHandle(fh->filehandle_secondary) != 0) {
ret = __wt_errno();
__wt_err(session, ret, "%s", fh->name);
}