1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Replace the confusing exit_nicely() by an atexit/on_exit hook

This commit is contained in:
Peter Eisentraut
2011-04-06 23:00:44 +03:00
parent 2bd78eb8d5
commit c75163842c
5 changed files with 37 additions and 43 deletions

View File

@ -99,7 +99,8 @@ pg_log(eLogType type, char *fmt,...)
case PG_FATAL:
printf("%s", "\n");
printf("%s", _(message));
exit_nicely(true);
printf("Failure, exiting\n");
exit(1);
break;
case PG_DEBUG:
@ -184,36 +185,6 @@ get_user_info(char **user_name)
}
void
exit_nicely(bool need_cleanup)
{
stop_postmaster(true, true);
pg_free(log_opts.filename);
if (log_opts.fd)
fclose(log_opts.fd);
if (log_opts.debug_fd)
fclose(log_opts.debug_fd);
/* terminate any running instance of postmaster */
if (os_info.postmasterPID != 0)
kill(os_info.postmasterPID, SIGTERM);
if (need_cleanup)
{
printf("Failure, exiting\n");
/*
* FIXME must delete intermediate files
*/
exit(1);
}
else
exit(0);
}
void *
pg_malloc(int n)
{