Navigation Menu

Skip to content

Commit

Permalink
Propagate double initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 3, 2015
1 parent 5d338d1 commit dba9cd4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pgroonga.c
Expand Up @@ -52,6 +52,8 @@ typedef struct stat pgrn_stat_buffer;

PG_MODULE_MAGIC;

static bool PGrnInitialized = false;

static bool PGrnIsLZ4Available;
static relopt_kind PGrnReloptionKind;

Expand Down Expand Up @@ -540,6 +542,13 @@ PGrnInitializeOptions(void)
void
_PG_init(void)
{
if (PGrnInitialized)
ereport(ERROR,
(errcode(ERRCODE_SYSTEM_ERROR),
errmsg("pgroonga: already tried to initialize and failed")));

PGrnInitialized = true;

PGrnInitializeVariables();

if (grn_init() != GRN_SUCCESS)
Expand Down

0 comments on commit dba9cd4

Please sign in to comment.