Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v
retrieving revision 1.560
diff -c -c -r1.560 postmaster.c
*** src/backend/postmaster/postmaster.c	26 Jun 2008 01:35:45 -0000	1.560
--- src/backend/postmaster/postmaster.c	26 Jun 2008 02:41:04 -0000
***************
*** 4184,4190 ****
  
  	fprintf(fp, "%s", fullprogname);
  	for (i = 1; i < argc; i++)
! 		fprintf(fp, " " SYSTEMQUOTE "%s" SYSTEMQUOTE, argv[i]);
  	fputs("\n", fp);
  
  	if (fclose(fp))
--- 4184,4190 ----
  
  	fprintf(fp, "%s", fullprogname);
  	for (i = 1; i < argc; i++)
! 		fprintf(fp, " \"%s\"", argv[i]);
  	fputs("\n", fp);
  
  	if (fclose(fp))
Index: src/bin/pg_ctl/pg_ctl.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_ctl/pg_ctl.c,v
retrieving revision 1.100
diff -c -c -r1.100 pg_ctl.c
*** src/bin/pg_ctl/pg_ctl.c	26 Jun 2008 01:35:45 -0000	1.100
--- src/bin/pg_ctl/pg_ctl.c	26 Jun 2008 02:41:04 -0000
***************
*** 573,583 ****
  {
  	if (post_opts == NULL)
  	{
- 		char	  **optlines;
- 
  		post_opts = "";		/* defatult */
  		if (ctl_command == RESTART_COMMAND)
  		{
  			optlines = readfile(postopts_file);
  			if (optlines == NULL)
  			{
--- 573,583 ----
  {
  	if (post_opts == NULL)
  	{
  		post_opts = "";		/* defatult */
  		if (ctl_command == RESTART_COMMAND)
  		{
+ 			char	  **optlines;
+ 
  			optlines = readfile(postopts_file);
  			if (optlines == NULL)
  			{
***************
*** 593,612 ****
  			else
  			{
  				int			len;
! 				char	   *optline = NULL;
  				char	   *arg1;
  
  				optline = optlines[0];
  				len = strcspn(optline, "\r\n");
  				optline[len] = '\0';
  
! 				arg1 = strchr(optline, *SYSTEMQUOTE);
! 				if (arg1 == NULL || arg1 == optline)
! 					post_opts = "";
! 				else
  				{
! 					*(arg1 - 1) = '\0'; /* this should be a space */
! 					post_opts = arg1;
  				}
  				if (postgres_path != NULL)
  					postgres_path = optline;
--- 593,618 ----
  			else
  			{
  				int			len;
! 				char	   *optline;
  				char	   *arg1;
  
  				optline = optlines[0];
+ 				/* trim off line endings */
  				len = strcspn(optline, "\r\n");
  				optline[len] = '\0';
  
! 				for (arg1 = optline; *arg1; arg1++)
  				{
! 					/*
! 					 * Are we at the first option, as defined by space,
! 					 * double-quote, and a dash?
! 					 */
! 					if (*arg1 == ' ' && *(arg1+1) == '"' && *(arg1+2) == '-')
! 					{
! 						*arg1 = '\0';	/* terminate so we get only program name */
! 						post_opts = arg1 + 1; /* point past whitespace */
! 						break;
! 					}
  				}
  				if (postgres_path != NULL)
  					postgres_path = optline;
