8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.81 2001/02/21 06:05:23 ishii Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.82 2001/03/10 04:21:51 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -451,7 +451,10 @@ elog(int lev, const char *fmt, ...)
451
451
* after proc_exit has begun to run. (It's proc_exit's
452
452
* responsibility to see that this doesn't turn into infinite
453
453
* recursion!)But in the latter case, we exit with nonzero exit
454
- * code to indicate that something's pretty wrong.
454
+ * code to indicate that something's pretty wrong. We also want
455
+ * to exit with nonzero exit code if not running under the postmaster
456
+ * (for example, if we are being run from the initdb script, we'd
457
+ * better return an error status).
455
458
*/
456
459
if (lev == FATAL || !Warn_restart_ready || proc_exit_inprogress )
457
460
{
@@ -463,7 +466,7 @@ elog(int lev, const char *fmt, ...)
463
466
*/
464
467
fflush (stdout );
465
468
fflush (stderr );
466
- proc_exit ((int )proc_exit_inprogress );
469
+ proc_exit ((int )( proc_exit_inprogress || ! IsUnderPostmaster ) );
467
470
}
468
471
469
472
/*