For reasons, I was trying to compile older versions of Postgres and ran into a strange behaviour where system() worked normally but then returned -1 with errno set to ECHILD. And surprisingly it looks like we've seen this behaviour in the past but on a Solaris:
commit 07d4d36aae79cf2ac365e381ed3e7ce62dcfa783 Author: Tatsuo Ishii <is...@postgresql.org> Date: Thu May 25 06:53:43 2000 +0000 On solaris, createdb/dropdb fails because of strange behavior of system(). (it returns error with errno ECHILD upon successful completion of commands). This fix ignores an error from system() if errno == ECHILD. It looks like Linux now behaves similarly, in fact there's a Redhat notice about this causing similar headaches in Oracle: https://access.redhat.com/solutions/37218 So just in case anyone else wants to use system() in Postgres or indeed any other Unix application that twiddles with the SIGCHILD handler this is something to beware of. It's not entirely clear to me that the mention of SA_NOCLDWAIT is the only way to get this behaviour, at least one stackoverflow answer implied just setting SIG_IGN was enough. -- greg -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers