diff options
| author | Magnus Hagander | 2008-04-10 16:58:51 +0000 |
|---|---|---|
| committer | Magnus Hagander | 2008-04-10 16:58:51 +0000 |
| commit | 47a19a495d89e00fd98ad7139beb0dbecedca353 (patch) | |
| tree | 4f061bb10cad784af09e3e434e0ac39bde01c1ef /src/include | |
| parent | a57a1e61a17c002b300da397726b9d0fd86b59a0 (diff) | |
Create wrapper pgwin32_safestat() and redefine stat() to it
on win32, because the stat() function in the runtime cannot
be trusted to always update the st_size field.
Per report and research by Sergey Zubkovsky.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/port.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/include/port.h b/src/include/port.h index 38c6c5f6869..e1cc4c74dc6 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.118 2008/02/29 15:31:33 mha Exp $ + * $PostgreSQL: pgsql/src/include/port.h,v 1.119 2008/04/10 16:58:51 mha Exp $ * *------------------------------------------------------------------------- */ @@ -298,6 +298,19 @@ 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); |
