Re: Use atexit() in initdb and pg_basebackup - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Use atexit() in initdb and pg_basebackup
Date
Msg-id 3d072ada-198a-f5ee-8769-bc51823d4f19@2ndquadrant.com
Whole thread Raw
In response to Re: Use atexit() in initdb and pg_basebackup  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Use atexit() in initdb and pg_basebackup  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On 04/01/2019 20:35, Alvaro Herrera wrote:
> Seems you're registering the atexit cb twice here; you should only do so
> in the first "!conn" block.

OK, fixed.

>> @@ -3438,5 +3437,8 @@ main(int argc, char *argv[])
>>  
>>      destroyPQExpBuffer(start_db_cmd);
>>  
>> +    /* prevent cleanup */
>> +    made_new_pgdata = found_existing_pgdata = made_new_xlogdir = found_existing_xlogdir = false;
>> +
>>      return 0;
>>  }
> 
> This is a bit ugly, but meh.

Yeah.  Actually, we already have a solution of this in pg_basebackup,
with a bool success variable.  I rewrote it like that.  At least it's
better for uniformity.

I also added an atexit() conversion in isolationtester.  It's mostly the
same thing.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: jsonpath
Next
From: Peter Eisentraut
Date:
Subject: Re: [PATCH] Log PostgreSQL version number on startup