Bruce Momjian wrote:
> OK, applied. I moved the funciton into port/dirmod.c and cleaned up the
> interface for Win32.
>
> Would someone test this on Win32 in case I broke something?
Yes, something's broken, see patch.
Second, HAVE_SYMLINK must be defined somewhere (configure?).
Third, a junction is a directory, not a file, so DROP tablespace must
use rmdir, not unlink to remove the junction; see my original patch.
Regards,
Andreas
Index: dirmod.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/port/dirmod.c,v
retrieving revision 1.14
diff -u -r1.14 dirmod.c
--- dirmod.c 7 Aug 2004 21:48:09 -0000 1.14
+++ dirmod.c 7 Aug 2004 22:31:25 -0000
@@ -153,9 +153,9 @@
{
HANDLE dirhandle;
DWORD len;
- char *p = nativeTarget;
char buffer[MAX_PATH*sizeof(WCHAR) + sizeof(REPARSE_JUNCTION_DATA_BUFFER)];
char nativeTarget[MAX_PATH];
+ char *p = nativeTarget;
REPARSE_JUNCTION_DATA_BUFFER *reparseBuf = (REPARSE_JUNCTION_DATA_BUFFER*)buffer;
CreateDirectory(newpath, 0);
@@ -203,9 +203,12 @@
NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&msg, 0, NULL );
+#ifdef FRONTEND
+ fprintf(stderr, "Error setting junction for %s: %s", nativeTarget, msg);
+#else
ereport(ERROR, (errcode_for_file_access(),
errmsg("Error setting junction for %s: %s", nativeTarget, msg)));
-
+#endif
LocalFree(msg);
CloseHandle(dirhandle);