66 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
77 * Portions Copyright (c) 1994, Regents of the University of California
88 *
9- * $PostgreSQL: pgsql/src/include/port.h,v 1.119 2008/04/10 16:58:51 mha Exp $
9+ * $PostgreSQL: pgsql/src/include/port.h,v 1.120 2008/04/11 23:53:00 tgl Exp $
1010 *
1111 *-------------------------------------------------------------------------
1212 */
@@ -281,9 +281,23 @@ extern void copydir(char *fromdir, char *todir, bool recurse);
281281
282282extern bool rmtree (char * path , bool rmtopdir );
283283
284+ /*
285+ * stat() is not guaranteed to set the st_size field on win32, so we
286+ * redefine it to our own implementation that is.
287+ *
288+ * We must pull in sys/stat.h here so the system header definition
289+ * goes in first, and we redefine that, and not the other way around.
290+ */
291+ #if defined(WIN32 ) && !defined(__CYGWIN__ )
292+ #include <sys/stat.h>
293+ extern int pgwin32_safestat (const char * path , struct stat * buf );
294+ #define stat (a ,b ) pgwin32_safestat(a,b)
295+ #endif
296+
284297#if defined(WIN32 ) && !defined(__CYGWIN__ )
285298
286- /* open() and fopen() replacements to allow deletion of open files and
299+ /*
300+ * open() and fopen() replacements to allow deletion of open files and
287301 * passing of other special options.
288302 */
289303#define O_DIRECT 0x80000000
@@ -298,19 +312,6 @@ extern FILE *pgwin32_fopen(const char *, const char *);
298312#define popen (a ,b ) _popen(a,b)
299313#define pclose (a ) _pclose(a)
300314
301- /*
302- * stat() is not guaranteed to set the st_size field on win32, so we
303- * redefine it to our own implementation that is.
304- *
305- * We must pull in sys/stat.h here so the system header definition
306- * goes in first, and we redefine that, and not the other way around.
307- */
308- extern int pgwin32_safestat (const char * path , struct stat * buf );
309- #if !defined(FRONTEND ) && !defined(_DIRMOD_C )
310- #include <sys/stat.h>
311- #define stat (a ,b ) pgwin32_safestat(a,b)
312- #endif
313-
314315/* Missing rand functions */
315316extern long lrand48 (void );
316317extern void srand48 (long seed );
0 commit comments