From 161d81d838807231f02fef8a75e01a3ff04bfca6 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Wed, 16 Apr 2008 14:21:23 +0000 Subject: [PATCH] Avoid using unnecessary pgwin32_safestat in libpq. --- src/include/port.h | 5 ++++- src/interfaces/libpq/Makefile | 2 +- src/tools/msvc/Mkvcbuild.pm | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/include/port.h b/src/include/port.h index b57136deaf..8bcef6c87e 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -286,8 +286,11 @@ extern bool rmtree(char *path, bool rmtopdir); * * 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. + * + * Some frontends don't need the size from stat, so if UNSAFE_STAT_OK + * is defined we don't bother with this. */ -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(WIN32) && !defined(__CYGWIN__) && !defined(UNSAFE_STAT_OK) #include extern int pgwin32_safestat(const char *path, struct stat *buf); #define stat(a,b) pgwin32_safestat(a,b) diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile index 1c795a47c7..9d02dec571 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile @@ -20,7 +20,7 @@ SO_MAJOR_VERSION= 5 SO_MINOR_VERSION= 1 DLTYPE= library -override CPPFLAGS := -DFRONTEND -I$(srcdir) $(CPPFLAGS) -I$(top_builddir)/src/port +override CPPFLAGS := -DFRONTEND -DUNSAFE_STAT_OK -I$(srcdir) $(CPPFLAGS) -I$(top_builddir)/src/port ifneq ($(PORTNAME), win32) override CFLAGS += $(PTHREAD_CFLAGS) endif diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 0c1aeb3cc9..bff1ef900d 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -127,6 +127,7 @@ sub mkvcbuild $libpq = $solution->AddProject('libpq','dll','interfaces','src\interfaces\libpq'); $libpq->AddDefine('FRONTEND'); + $libpq->AddDefine('UNSAFE_STAT_OK'); $libpq->AddIncludeDir('src\port'); $libpq->AddLibrary('wsock32.lib'); $libpq->AddLibrary('secur32.lib'); -- 2.39.5