[Groonga-commit] groonga/groonga at 0259c9a [master] Really fix a bug that daemonize doesn't work on OS X

Back to archive index

Kouhei Sutou null+****@clear*****
Mon May 27 12:43:35 JST 2013


Kouhei Sutou	2013-05-27 12:43:35 +0900 (Mon, 27 May 2013)

  New Revision: 0259c9a09c518e21605bcb3c013834d68cdbaddd
  https://github.com/groonga/groonga/commit/0259c9a09c518e21605bcb3c013834d68cdbaddd

  Message:
    Really fix a bug that daemonize doesn't work on OS X
    
    The previous commit doesn't solve the problem. >_<

  Modified files:
    src/groonga.c

  Modified: src/groonga.c (+13 -6)
===================================================================
--- src/groonga.c    2013-05-27 12:34:45 +0900 (13a5370)
+++ src/groonga.c    2013-05-27 12:43:35 +0900 (4d584a7)
@@ -607,17 +607,19 @@ start_service(grn_ctx *ctx, const char *db_path,
 {
   int exit_code = EXIT_SUCCESS;
   grn_com_event ev;
+
+  if (is_daemon_mode) {
+    exit_code = daemonize();
+    if (exit_code != EXIT_SUCCESS) {
+      return exit_code;
+    }
+  }
+
   if (!grn_com_event_init(ctx, &ev, MAX_CON, sizeof(grn_com))) {
     grn_obj *db;
     db = (newdb || !db_path) ? grn_db_create(ctx, db_path, NULL) : grn_db_open(ctx, db_path);
     if (db) {
-      if (is_daemon_mode) {
-        daemonize();
-      }
       exit_code = run_server(ctx, db, &ev, dispatcher, handler);
-      if (is_daemon_mode) {
-        clean_pid_file();
-      }
       grn_obj_close(ctx, db);
     } else {
       fprintf(stderr, "db open failed (%s)\n", db_path);
@@ -628,6 +630,11 @@ start_service(grn_ctx *ctx, const char *db_path,
     fprintf(stderr, "grn_com_event_init failed\n");
     exit_code = EXIT_FAILURE;
   }
+
+  if (is_daemon_mode) {
+    clean_pid_file();
+  }
+
   return exit_code;
 }
 
-------------- next part --------------
HTML����������������������������...
Download 



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