[Groonga-commit] groonga/groonga [master] windows: fix a bug that over 128MB column value can't be read

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Nov 5 19:05:35 JST 2012


Kouhei Sutou	2012-11-05 19:05:35 +0900 (Mon, 05 Nov 2012)

  New Revision: 96ab5e1bb8ab6a4fdb9649a575985566539613e4
  https://github.com/groonga/groonga/commit/96ab5e1bb8ab6a4fdb9649a575985566539613e4

  Log:
    windows: fix a bug that over 128MB column value can't be read
    
    [groonga-dev,01088]
    
    Reported by ongaeshi. Thanks!!!

  Modified files:
    lib/io.c

  Modified: lib/io.c (+14 -2)
===================================================================
--- lib/io.c    2012-11-05 16:53:32 +0900 (ba3ef6b)
+++ lib/io.c    2012-11-05 19:05:35 +0900 (4200a83)
@@ -1526,9 +1526,15 @@ inline static grn_rc
 grn_open(grn_ctx *ctx, fileinfo *fi, const char *path, int flags, size_t maxsize)
 {
   if ((flags & O_CREAT)) {
+    DWORD dwCreationDisposition;
+    if (flags & O_EXCL) {
+      dwCreationDisposition = CREATE_NEW;
+    } else {
+      dwCreationDisposition = OPEN_ALWAYS;
+    }
     fi->fh = CreateFile(path, GENERIC_READ | GENERIC_WRITE,
                         FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
-                        CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
+                        dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0);
     if (fi->fh == INVALID_HANDLE_VALUE) {
       SERR("CreateFile");
       return ctx->rc;
@@ -1629,9 +1635,15 @@ grn_open(grn_ctx *ctx, fileinfo *fi, const char *path, int flags, size_t maxsize
 {
   /* may be wrong if flags is just only O_RDWR */
   if ((flags & O_CREAT)) {
+    DWORD dwCreationDisposition;
+    if (flags & O_EXCL) {
+      dwCreationDisposition = CREATE_NEW;
+    } else {
+      dwCreationDisposition = OPEN_ALWAYS;
+    }
     fi->fh = CreateFile(path, GENERIC_READ | GENERIC_WRITE,
                         FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
-                        CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
+                        dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0);
     if (fi->fh == INVALID_HANDLE_VALUE) {
       SERR("CreateFile");
       return ctx->rc;
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index