[Groonga-commit] groonga/groonga at 65129f8 [master] Stop to use grn_file_lock without NULL path

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Mar 3 21:51:25 JST 2018


Kouhei Sutou	2018-03-03 21:51:25 +0900 (Sat, 03 Mar 2018)

  New Revision: 65129f8c40e68f871bcffca24e1ea56023052764
  https://github.com/groonga/groonga/commit/65129f8c40e68f871bcffca24e1ea56023052764

  Message:
    Stop to use grn_file_lock without NULL path

  Modified files:
    lib/cache.c

  Modified: lib/cache.c (+6 -8)
===================================================================
--- lib/cache.c    2018-03-03 21:50:49 +0900 (f26f5ddb4)
+++ lib/cache.c    2018-03-03 21:51:25 +0900 (39a8d9091)
@@ -151,14 +151,10 @@ grn_cache_open_persistent(grn_ctx *ctx,
   cache->impl.persistent.timeout = 1000;
 
   if (base_path) {
+    struct stat stat_buffer;
+
     grn_snprintf(lock_path_buffer, PATH_MAX, PATH_MAX, "%s.lock", base_path);
     grn_file_lock_init(ctx, &file_lock, lock_path_buffer);
-  } else {
-    grn_file_lock_init(ctx, &file_lock, NULL);
-  }
-
-  if (base_path) {
-    struct stat stat_buffer;
 
     grn_snprintf(keys_path_buffer, PATH_MAX, PATH_MAX, "%s.keys", base_path);
     grn_snprintf(values_path_buffer, PATH_MAX, PATH_MAX, "%s.values", base_path);
@@ -297,8 +293,10 @@ grn_cache_open_persistent(grn_ctx *ctx,
   }
 
 exit :
-  grn_file_lock_release(ctx, &file_lock);
-  grn_file_lock_fin(ctx, &file_lock);
+  if (base_path) {
+    grn_file_lock_release(ctx, &file_lock);
+    grn_file_lock_fin(ctx, &file_lock);
+  }
 }
 
 static grn_cache *
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180303/25a6bcf5/attachment-0001.htm 



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