aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/error/elog.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-03-10 04:21:51 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-03-10 04:21:51 +0000
commit2cfc8fcb5d48ac8f5d82e078f59f25ec4dc7de09 (patch)
tree43559993f65ea39e35ef0ff741d05be9c9c71040 /src/backend/utils/error/elog.c
parente666422ebf51b9433db1f413af38962a0937a69e (diff)
downloadpostgresql-2cfc8fcb5d48ac8f5d82e078f59f25ec4dc7de09.tar.gz
postgresql-2cfc8fcb5d48ac8f5d82e078f59f25ec4dc7de09.zip
FATAL errors should cause exit with nonzero status if we are not running
under the postmaster --- specifically, if we are a standalone backend running under the initdb script, this is critical!
Diffstat (limited to 'src/backend/utils/error/elog.c')
-rw-r--r--src/backend/utils/error/elog.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index c19ad44d63b..a8b6215930e 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.81 2001/02/21 06:05:23 ishii Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.82 2001/03/10 04:21:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -451,7 +451,10 @@ elog(int lev, const char *fmt, ...)
* after proc_exit has begun to run. (It's proc_exit's
* responsibility to see that this doesn't turn into infinite
* recursion!) But in the latter case, we exit with nonzero exit
- * code to indicate that something's pretty wrong.
+ * code to indicate that something's pretty wrong. We also want
+ * to exit with nonzero exit code if not running under the postmaster
+ * (for example, if we are being run from the initdb script, we'd
+ * better return an error status).
*/
if (lev == FATAL || !Warn_restart_ready || proc_exit_inprogress)
{
@@ -463,7 +466,7 @@ elog(int lev, const char *fmt, ...)
*/
fflush(stdout);
fflush(stderr);
- proc_exit((int) proc_exit_inprogress);
+ proc_exit((int) (proc_exit_inprogress || !IsUnderPostmaster));
}
/*