Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v
retrieving revision 1.508
diff -c -c -r1.508 postmaster.c
*** src/backend/postmaster/postmaster.c	16 Jan 2007 13:28:56 -0000	1.508
--- src/backend/postmaster/postmaster.c	22 Jan 2007 04:51:01 -0000
***************
*** 2426,2432 ****
  		/*------
  		  translator: %s is a noun phrase describing a child process, such as
  		  "server process" */
! 				(errmsg("%s (PID %d) was terminated by signal %d",
  						procname, pid, WTERMSIG(exitstatus))));
  	else
  		ereport(lev,
--- 2426,2432 ----
  		/*------
  		  translator: %s is a noun phrase describing a child process, such as
  		  "server process" */
! 				(errmsg("%s (PID %d) was terminated by signal "PRINTF_SIGNUM,
  						procname, pid, WTERMSIG(exitstatus))));
  	else
  		ereport(lev,
Index: src/include/c.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/c.h,v
retrieving revision 1.216
diff -c -c -r1.216 c.h
*** src/include/c.h	11 Jan 2007 02:39:52 -0000	1.216
--- src/include/c.h	22 Jan 2007 04:51:02 -0000
***************
*** 788,793 ****
--- 788,800 ----
  #define SIGNAL_ARGS  int postgres_signal_arg
  #endif
  
+ #ifndef WIN32
+ #define PRINTF_SIGNUM	"%d"
+ #else
+ /* Win32 non-exit system() return values are high, see port/win32.h */
+ #define PRINTF_SIGNUM	"%X"
+ #endif
+ 
  /*
   * When there is no sigsetjmp, its functionality is provided by plain
   * setjmp. Incidentally, nothing provides setjmp's functionality in
Index: src/include/port/win32.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/port/win32.h,v
retrieving revision 1.65
diff -c -c -r1.65 win32.h
*** src/include/port/win32.h	11 Jan 2007 02:42:31 -0000	1.65
--- src/include/port/win32.h	22 Jan 2007 04:51:02 -0000
***************
*** 115,130 ****
  
  /*
   *	Signal stuff
!  *	WIN32 doesn't have wait(), so the return value for children
!  *	is simply the return value specified by the child, without
!  *	any additional information on whether the child terminated
!  *	on its own or via a signal.  These macros are also used
!  *	to interpret the return value of system().
!  */
! #define WEXITSTATUS(w)	(w)
! #define WIFEXITED(w)	(true)
! #define WIFSIGNALED(w)	(false)
! #define WTERMSIG(w)		(0)
  
  #define sigmask(sig) ( 1 << ((sig)-1) )
  
--- 115,134 ----
  
  /*
   *	Signal stuff
!  *	For WIN32, there is no wait() call so there are no wait() macros
!  *	to interpret the return value of system().  Instead, system()
!  *	return values < 0x100 are used for exit() termination, and higher
!  *	values are used to indicated non-exit() termination, which is
!  *	similar to a unix-style signal exit (think SIGSEGV ==
!  *	STATUS_ACCESS_VIOLATION).  See this URL for a list of WIN32 
!  *	STATUS_* values from Wine:
!  *
!  *		http://source.winehq.org/source/include/ntstatus.h
!  */
! #define WIFEXITED(w)    (((w) & 0xffffff00) == 0)
! #define WIFSIGNALED(w)  (!WIFEXITED(w))
! #define WEXITSTATUS(w)  (w)
! #define WTERMSIG(w)     (w)
  
  #define sigmask(sig) ( 1 << ((sig)-1) )
  
Index: src/port/exec.c
===================================================================
RCS file: /cvsroot/pgsql/src/port/exec.c,v
retrieving revision 1.44
diff -c -c -r1.44 exec.c
*** src/port/exec.c	5 Jan 2007 22:20:02 -0000	1.44
--- src/port/exec.c	22 Jan 2007 04:51:03 -0000
***************
*** 582,588 ****
  		log_error(_("child process exited with exit code %d"),
  				  WEXITSTATUS(exitstatus));
  	else if (WIFSIGNALED(exitstatus))
! 		log_error(_("child process was terminated by signal %d"),
  				  WTERMSIG(exitstatus));
  	else
  		log_error(_("child process exited with unrecognized status %d"),
--- 582,588 ----
  		log_error(_("child process exited with exit code %d"),
  				  WEXITSTATUS(exitstatus));
  	else if (WIFSIGNALED(exitstatus))
! 		log_error(_("child process was terminated by signal "PRINTF_SIGNUM),
  				  WTERMSIG(exitstatus));
  	else
  		log_error(_("child process exited with unrecognized status %d"),
