Fix segfault of pcp_systemdb_info not in parallel mode and when enable_query_cache...
authorNozomi Anzai <anzai@sraoss.co.jp>
Thu, 31 May 2012 07:28:20 +0000 (16:28 +0900)
committerNozomi Anzai <anzai@sraoss.co.jp>
Thu, 31 May 2012 07:28:20 +0000 (16:28 +0900)
pcp_child.c

index 0a54f817b50cd351d154ac18a1bb5a07f87a3466..dbe4254a6414ee82218a26d8113f2cf46dab0d15 100644 (file)
@@ -596,9 +596,6 @@ pcp_do_child(int unix_fd, int inet_fd, char *pcp_conf_file)
                                SystemDBInfo *si = NULL;
                                si = pool_get_system_db_info();
 
-                               /* since PCP clients can only see SystemDBInfo, set system_db_status from the shared memory */
-                               si->system_db_status = SYSDB_STATUS;
-
                                if (si == NULL)
                                {
                                        char code[] = "SystemDBNotDefined";
@@ -623,6 +620,9 @@ pcp_do_child(int unix_fd, int inet_fd, char *pcp_conf_file)
                                        /* finally, indicate that all data is sent */
                                        char fin_code[] = "CommandComplete";
 
+                                       /* since PCP clients can only see SystemDBInfo, set system_db_status from the shared memory */
+                                       si->system_db_status = SYSDB_STATUS;
+
                                        snprintf(port, sizeof(port), "%d", si->port);
                                        snprintf(status, sizeof(status), "%d", si->system_db_status);
                                        snprintf(dist_def_num, sizeof(dist_def_num), "%d", si->dist_def_num);