Skip to content

Commit e154698

Browse files
committed
Initialize main_tid before any elog() calls
1 parent 71d41ac commit e154698

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/pg_probackup.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ main(int argc, char *argv[])
188188
PROGRAM_NAME = get_progname(argv[0]);
189189
set_pglocale_pgservice(argv[0], "pgscripts");
190190

191+
/*
192+
* Save main thread's tid. It is used call exit() in case of errors.
193+
*/
194+
main_tid = pthread_self();
195+
191196
/* Parse subcommands and non-subcommand options */
192197
if (argc > 1)
193198
{

src/utils/pgut.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,6 @@ pgut_getopt(int argc, char **argv, pgut_option options[])
10671067

10681068
init_cancel_handler();
10691069
atexit(on_cleanup);
1070-
main_tid = pthread_self();
10711070

10721071
return optind;
10731072
}

0 commit comments

Comments
 (0)