1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

Fix handling of SIGCHLD, per recent pghackers discussion: on some

platforms system(2) gets confused unless the signal handler is set to
SIG_DFL, not SIG_IGN.  pgstats.c now uses pqsignal() as it should,
not signal().  Also, arrange for the stats collector process to show
a reasonable ID in 'ps', rather than looking like a postmaster.
This commit is contained in:
Tom Lane
2001-08-04 00:14:43 +00:00
parent 2b769c8212
commit dad8e410d0
6 changed files with 91 additions and 72 deletions

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.76 2001/07/02 20:50:46 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.77 2001/08/04 00:14:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -58,7 +58,6 @@ createdb(const char *dbname, const char *dbpath,
char *target_dir;
char src_loc[MAXPGPATH];
char buf[2 * MAXPGPATH + 100];
int ret;
bool use_super,
use_createdb;
Oid src_dboid;
@ -195,9 +194,7 @@ createdb(const char *dbname, const char *dbpath,
/* Copy the template database to the new location */
snprintf(buf, sizeof(buf), "cp -r '%s' '%s'", src_loc, target_dir);
ret = system(buf);
/* Some versions of SunOS seem to return ECHILD after a system() call */
if (ret != 0 && errno != ECHILD)
if (system(buf) != 0)
{
if (remove_dbdirs(nominal_loc, alt_loc))
elog(ERROR, "CREATE DATABASE: could not initialize database directory");
@ -557,7 +554,7 @@ remove_dbdirs(const char *nominal_loc, const char *alt_loc)
snprintf(buf, sizeof(buf), "rm -rf '%s'", target_dir);
if (system(buf) != 0 && errno != ECHILD)
if (system(buf) != 0)
{
elog(NOTICE, "database directory '%s' could not be removed",
target_dir);