Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d9e7495

Browse files
committed
Register atexit hook only once in pg_upgrade.
start_postmaster() registered stop_postmaster_atexit as an atexit(3) callback each time through, although the obvious intention was to do so only once per program run. The extra registrations were harmless, so long as we didn't exceed ATEXIT_MAX, but still it's a bug. Artur Zakirov, with bikeshedding by Kyotaro Horiguchi and me Discussion: <d279e817-02b5-caa6-215f-cfb05dce109a@postgrespro.ru>
1 parent de8c92e commit d9e7495

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bin/pg_upgrade/server.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,11 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
174174
{
175175
char cmd[MAXPGPATH * 4 + 1000];
176176
PGconn *conn;
177-
bool exit_hook_registered = false;
178177
bool pg_ctl_return = false;
179178
char socket_string[MAXPGPATH + 200];
180179

180+
static bool exit_hook_registered = false;
181+
181182
if (!exit_hook_registered)
182183
{
183184
atexit(stop_postmaster_atexit);

0 commit comments

Comments
 (0)