Skip to content

Commit e8d11ad

Browse files
committed
Avoid using unnecessary pgwin32_safestat in libpq.
1 parent 17cdf84 commit e8d11ad

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/include/port.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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.120 2008/04/11 23:53:00 tgl Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.121 2008/04/16 14:19:56 adunstan Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -287,8 +287,11 @@ extern bool rmtree(char *path, bool rmtopdir);
287287
*
288288
* We must pull in sys/stat.h here so the system header definition
289289
* goes in first, and we redefine that, and not the other way around.
290+
*
291+
* Some frontends don't need the size from stat, so if UNSAFE_STAT_OK
292+
* is defined we don't bother with this.
290293
*/
291-
#if defined(WIN32) && !defined(__CYGWIN__)
294+
#if defined(WIN32) && !defined(__CYGWIN__) && !defined(UNSAFE_STAT_OK)
292295
#include <sys/stat.h>
293296
extern int pgwin32_safestat(const char *path, struct stat *buf);
294297
#define stat(a,b) pgwin32_safestat(a,b)

src/interfaces/libpq/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.165 2008/04/07 14:15:58 petere Exp $
8+
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.166 2008/04/16 14:19:56 adunstan Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -19,7 +19,7 @@ NAME= pq
1919
SO_MAJOR_VERSION= 5
2020
SO_MINOR_VERSION= 2
2121

22-
override CPPFLAGS := -DFRONTEND -I$(srcdir) $(CPPFLAGS) -I$(top_builddir)/src/port
22+
override CPPFLAGS := -DFRONTEND -DUNSAFE_STAT_OK -I$(srcdir) $(CPPFLAGS) -I$(top_builddir)/src/port
2323
ifneq ($(PORTNAME), win32)
2424
override CFLAGS += $(PTHREAD_CFLAGS)
2525
endif

src/tools/msvc/Mkvcbuild.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package Mkvcbuild;
33
#
44
# Package that generates build files for msvc build
55
#
6-
# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.26 2008/02/28 12:17:59 mha Exp $
6+
# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.27 2008/04/16 14:19:56 adunstan Exp $
77
#
88
use Carp;
99
use Win32;
@@ -127,6 +127,7 @@ sub mkvcbuild
127127

128128
$libpq = $solution->AddProject('libpq','dll','interfaces','src\interfaces\libpq');
129129
$libpq->AddDefine('FRONTEND');
130+
$libpq->AddDefine('UNSAFE_STAT_OK');
130131
$libpq->AddIncludeDir('src\port');
131132
$libpq->AddLibrary('wsock32.lib');
132133
$libpq->AddLibrary('secur32.lib');

0 commit comments

Comments
 (0)