[Groonga-commit] groonga/grnxx at 2d5d035 [master] Fix a bug that grnxx::Storage is not correctly locked in read-only mode.

Back to archive index

susumu.yata null+****@clear*****
Tue May 7 18:01:08 JST 2013


susumu.yata	2013-05-07 18:01:08 +0900 (Tue, 07 May 2013)

  New Revision: 2d5d035642d08797c3dfd568731abd2b552ac89f
  https://github.com/groonga/grnxx/commit/2d5d035642d08797c3dfd568731abd2b552ac89f

  Message:
    Fix a bug that grnxx::Storage is not correctly locked in read-only mode.

  Modified files:
    lib/grnxx/storage/storage_impl.cpp

  Modified: lib/grnxx/storage/storage_impl.cpp (+8 -8)
===================================================================
--- lib/grnxx/storage/storage_impl.cpp    2013-05-06 16:18:57 +0900 (7cb783f)
+++ lib/grnxx/storage/storage_impl.cpp    2013-05-07 18:01:08 +0900 (35fe74e)
@@ -1090,14 +1090,14 @@ Chunk *StorageImpl::get_body_chunk(uint16_t chunk_id) {
 
 File *StorageImpl::get_file(uint16_t file_id) {
   if (!files_[file_id]) {
-    FileFlags file_flags = FILE_DEFAULT;
-    if (flags_ & STORAGE_READ_ONLY) {
-      file_flags |= FILE_READ_ONLY;
-      std::unique_ptr<char[]> path(generate_path(file_id));
-      files_[file_id].reset(File::open(path.get(), file_flags));
-    } else {
-      Lock file_lock(&header_->file_mutex);
-      if (!files_[file_id]) {
+    Lock file_lock(&header_->file_mutex);
+    if (!files_[file_id]) {
+      FileFlags file_flags = FILE_DEFAULT;
+      if (flags_ & STORAGE_READ_ONLY) {
+        file_flags |= FILE_READ_ONLY;
+        std::unique_ptr<char[]> path(generate_path(file_id));
+        files_[file_id].reset(File::open(path.get(), file_flags));
+      } else {
         if (flags_ & STORAGE_TEMPORARY) {
           file_flags |= FILE_TEMPORARY;
           files_[file_id].reset(File::create(path_.get(), file_flags));
-------------- next part --------------
HTML����������������������������...
Download 



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