diff options
Diffstat (limited to 'src/include/port.h')
-rw-r--r-- | src/include/port.h | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/include/port.h b/src/include/port.h index e1cc4c74dc6..3215b5f0a24 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/port.h,v 1.119 2008/04/10 16:58:51 mha Exp $ + * $PostgreSQL: pgsql/src/include/port.h,v 1.120 2008/04/11 23:53:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -281,9 +281,23 @@ extern void copydir(char *fromdir, char *todir, bool recurse); extern bool rmtree(char *path, bool rmtopdir); +/* + * stat() is not guaranteed to set the st_size field on win32, so we + * redefine it to our own implementation that is. + * + * We must pull in sys/stat.h here so the system header definition + * goes in first, and we redefine that, and not the other way around. + */ +#if defined(WIN32) && !defined(__CYGWIN__) +#include <sys/stat.h> +extern int pgwin32_safestat(const char *path, struct stat *buf); +#define stat(a,b) pgwin32_safestat(a,b) +#endif + #if defined(WIN32) && !defined(__CYGWIN__) -/* open() and fopen() replacements to allow deletion of open files and +/* + * open() and fopen() replacements to allow deletion of open files and * passing of other special options. */ #define O_DIRECT 0x80000000 @@ -298,19 +312,6 @@ extern FILE *pgwin32_fopen(const char *, const char *); #define popen(a,b) _popen(a,b) #define pclose(a) _pclose(a) -/* - * stat() is not guaranteed to set the st_size field on win32, so we - * redefine it to our own implementation that is. - * - * We must pull in sys/stat.h here so the system header definition - * goes in first, and we redefine that, and not the other way around. - */ -extern int pgwin32_safestat(const char *path, struct stat *buf); -#if !defined(FRONTEND) && !defined(_DIRMOD_C) -#include <sys/stat.h> -#define stat(a,b) pgwin32_safestat(a,b) -#endif - /* Missing rand functions */ extern long lrand48(void); extern void srand48(long seed); |