[Groonga-commit] groonga/groonga at 91207ec [master] Fix a regression bug that static index construction doesn't work

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Dec 12 18:57:37 JST 2014


Kouhei Sutou	2014-12-12 18:57:37 +0900 (Fri, 12 Dec 2014)

  New Revision: 91207ecd816e873cdf7070ec7a1c5ae4870f7e6e
  https://github.com/groonga/groonga/commit/91207ecd816e873cdf7070ec7a1c5ae4870f7e6e

  Message:
    Fix a regression bug that static index construction doesn't work
    
    Error message:
    
        [[-3,1418292129.47539,0.0114610195159912,
         "syscall error 'mkostemp' (No such file or directory)",
         [["grn_ii_buffer_open","ii.c",7422]]],false]
    
    It is caused on (BSD based OS) and (not have mkostemp(3)) environment
    such as OS X.
    
    GitHub: fix #264
    
    Reported by Ayumu Osanai. Thanks!!!

  Modified files:
    lib/grn.h
    lib/ii.c

  Modified: lib/grn.h (+2 -2)
===================================================================
--- lib/grn.h    2014-12-11 00:18:01 +0900 (868133c)
+++ lib/grn.h    2014-12-12 18:57:37 +0900 (b7f78e2)
@@ -546,7 +546,7 @@ typedef int grn_cond;
 #  define GRN_MKOSTEMP(template,flags,mode) mkostemp(template,flags)
 # else /* HAVE_MKOSTEMP */
 #  define GRN_MKOSTEMP(template,flags,mode) \
-  (mktemp(template), GRN_OPEN((template),flags,mode))
+  (mktemp(template), GRN_OPEN((template),((flags)|O_RDWR|O_CREAT|O_EXCL),mode))
 # endif /* HAVE_MKOSTEMP */
 
 #elif (defined(WIN32) || defined (_WIN64)) /* __GNUC__ */
@@ -579,7 +579,7 @@ typedef int grn_cond;
 # define GRN_BIT_SCAN_REV0(v,r) GRN_BIT_SCAN_REV(v,r)
 
 # define GRN_MKOSTEMP(template,flags,mode) \
-  (mktemp(template), GRN_OPEN((template),((flags)|O_BINARY),mode))
+  (mktemp(template), GRN_OPEN((template),((flags)|O_RDWR|O_CREAT),mode))
 
 #else /* __GNUC__ */
 

  Modified: lib/ii.c (+1 -4)
===================================================================
--- lib/ii.c    2014-12-11 00:18:01 +0900 (3e48bef)
+++ lib/ii.c    2014-12-12 18:57:37 +0900 (2ec4949)
@@ -7428,13 +7428,10 @@ grn_ii_buffer_open(grn_ctx *ctx, grn_ii *ii,
       if (ii_buffer->counters) {
         ii_buffer->block_buf = GRN_MALLOCN(grn_id, II_BUFFER_BLOCK_SIZE);
         if (ii_buffer->block_buf) {
-          int open_flags = O_WRONLY|O_CREAT;
+          int open_flags = 0;
 #ifdef WIN32
           open_flags |= O_BINARY;
 #endif
-#ifdef BSD
-          open_flags &= O_APPEND|O_DIRECT|O_SHLOCK|O_EXLOCK|O_SYNC|O_CLOEXEC;
-#endif
           snprintf(ii_buffer->tmpfpath, PATH_MAX,
                    "%sXXXXXX", grn_io_path(ii->seg));
           ii_buffer->block_buf_size = II_BUFFER_BLOCK_SIZE;
-------------- next part --------------
HTML����������������������������...
Download 



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