Commit 6bc12a4a authored by Tom Lane's avatar Tom Lane

Get dirmod.c on the same page as port.h about whether we use pgsymlink

on Cygwin (answer: we don't).  Also try to unwind the #ifdef spaghetti
a little bit.  Untested but hopefully I didn't break anything.
parent ad44c958
......@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/port.h,v 1.111 2007/04/13 10:30:30 mha Exp $
* $PostgreSQL: pgsql/src/include/port.h,v 1.112 2007/07/12 23:28:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -241,8 +241,7 @@ extern int pclose_check(FILE *stream);
#if defined(WIN32) || defined(__CYGWIN__)
/*
* Win32 doesn't have reliable rename/unlink during concurrent access,
* and we need special code to do symlinks.
* Win32 doesn't have reliable rename/unlink during concurrent access.
*/
extern int pgrename(const char *from, const char *to);
extern int pgunlink(const char *path);
......@@ -255,9 +254,14 @@ extern int pgunlink(const char *path);
#define rename(from, to) pgrename(from, to)
#define unlink(path) pgunlink(path)
#endif /* defined(WIN32) || defined(__CYGWIN__) */
/*
* Win32 also doesn't have symlinks, but we can emulate them with
* junction points on newer Win32 versions.
*
* Cygwin has its own symlinks which work on Win95/98/ME where
* junction points don't, so use it instead. We have no way of
* junction points don't, so use those instead. We have no way of
* knowing what type of system Cygwin binaries will be run on.
* Note: Some CYGWIN includes might #define WIN32.
*/
......@@ -266,7 +270,6 @@ extern int pgsymlink(const char *oldpath, const char *newpath);
#define symlink(oldpath, newpath) pgsymlink(oldpath, newpath)
#endif
#endif /* defined(WIN32) || defined(__CYGWIN__) */
extern void copydir(char *fromdir, char *todir, bool recurse);
......
......@@ -10,7 +10,7 @@
* Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.47 2007/01/19 16:42:24 alvherre Exp $
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.48 2007/07/12 23:28:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -103,6 +103,7 @@ fe_repalloc(void *pointer, Size size)
}
return res;
}
#endif /* FRONTEND */
......@@ -169,8 +170,14 @@ pgunlink(const char *path)
return 0;
}
/* We undefined these above; now redefine for possible use below */
#define rename(from, to) pgrename(from, to)
#define unlink(path) pgunlink(path)
#endif /* defined(WIN32) || defined(__CYGWIN__) */
#ifdef WIN32 /* Cygwin has its own symlinks */
#if defined(WIN32) && !defined(__CYGWIN__) /* Cygwin has its own symlinks */
/*
* pgsymlink support:
......@@ -276,14 +283,8 @@ pgsymlink(const char *oldpath, const char *newpath)
return 0;
}
#endif /* WIN32 */
#endif /* defined(WIN32) || defined(__CYGWIN__) */
/* We undefined this above, so we redefine it */
#if defined(WIN32) || defined(__CYGWIN__)
#define unlink(path) pgunlink(path)
#endif
#endif /* defined(WIN32) && !defined(__CYGWIN__) */
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment