Tom Lane wrote:
> [ looks again... ]  Actually, I think you just proved my point for me.
> The ZeroMemory call should go away, no? 

Yup, quite correct. v3 attached.

/D
Index: src/backend/port/win32/signal.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/port/win32/signal.c,v
retrieving revision 1.18
diff -c -r1.18 signal.c
*** src/backend/port/win32/signal.c	5 Jan 2007 22:19:35 -0000	1.18
--- src/backend/port/win32/signal.c	23 Oct 2007 16:02:41 -0000
***************
*** 178,184 ****
  	char		pipename[128];
  	HANDLE		pipe;
  
! 	wsprintf(pipename, "\\\\.\\pipe\\pgsignal_%d", (int) pid);
  
  	pipe = CreateNamedPipe(pipename, PIPE_ACCESS_DUPLEX,
  					   PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
--- 178,184 ----
  	char		pipename[128];
  	HANDLE		pipe;
  
! 	snprintf(pipename, sizeof(pipename), "\\\\.\\pipe\\pgsignal_%u", (int) pid);
  
  	pipe = CreateNamedPipe(pipename, PIPE_ACCESS_DUPLEX,
  					   PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
***************
*** 251,257 ****
  	char		pipename[128];
  	HANDLE		pipe = pgwin32_initial_signal_pipe;
  
! 	wsprintf(pipename, "\\\\.\\pipe\\pgsignal_%d", GetCurrentProcessId());
  
  	for (;;)
  	{
--- 251,257 ----
  	char		pipename[128];
  	HANDLE		pipe = pgwin32_initial_signal_pipe;
  
! 	snprintf(pipename, sizeof(pipename), "\\\\.\\pipe\\pgsignal_%u", GetCurrentProcessId());
  
  	for (;;)
  	{
Index: src/port/kill.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/port/kill.c,v
retrieving revision 1.8
diff -c -r1.8 kill.c
*** src/port/kill.c	5 Jan 2007 22:20:02 -0000	1.8
--- src/port/kill.c	23 Oct 2007 16:02:41 -0000
***************
*** 38,44 ****
  		errno = EINVAL;
  		return -1;
  	}
! 	wsprintf(pipename, "\\\\.\\pipe\\pgsignal_%i", pid);
  	if (!CallNamedPipe(pipename, &sigData, 1, &sigRet, 1, &bytes, 1000))
  	{
  		if (GetLastError() == ERROR_FILE_NOT_FOUND)
--- 38,44 ----
  		errno = EINVAL;
  		return -1;
  	}
! 	snprintf(pipename, sizeof(pipename), "\\\\.\\pipe\\pgsignal_%u", pid);
  	if (!CallNamedPipe(pipename, &sigData, 1, &sigRet, 1, &bytes, 1000))
  	{
  		if (GetLastError() == ERROR_FILE_NOT_FOUND)
Index: src/port/path.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/port/path.c,v
retrieving revision 1.71
diff -c -r1.71 path.c
*** src/port/path.c	5 Jan 2007 22:20:02 -0000	1.71
--- src/port/path.c	23 Oct 2007 16:04:42 -0000
***************
*** 628,637 ****
  	strlcpy(ret_path, pwd->pw_dir, MAXPGPATH);
  	return true;
  #else
! 	char		tmppath[MAX_PATH];
  
! 	ZeroMemory(tmppath, sizeof(tmppath));
! 	if (SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, tmppath) != S_OK)
  		return false;
  	snprintf(ret_path, MAXPGPATH, "%s/postgresql", tmppath);
  	return true;
--- 628,641 ----
  	strlcpy(ret_path, pwd->pw_dir, MAXPGPATH);
  	return true;
  #else
! 	char		*tmppath;
  
!     /*
!      * Note: We use getenv here because the more modern SHGetSpecialFolderPath()
!      * will force us to link with shell32.lib which eats valuable desktop heap.
!      */
!     tmppath = getenv("APPDATA");
! 	if (!tmppath)
  		return false;
  	snprintf(ret_path, MAXPGPATH, "%s/postgresql", tmppath);
  	return true;
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to