Avoid using unnecessary pgwin32_safestat in libpq.
authorAndrew Dunstan <andrew@dunslane.net>
Wed, 16 Apr 2008 14:21:23 +0000 (14:21 +0000)
committerAndrew Dunstan <andrew@dunslane.net>
Wed, 16 Apr 2008 14:21:23 +0000 (14:21 +0000)
src/include/port.h
src/interfaces/libpq/Makefile
src/tools/msvc/Mkvcbuild.pm

index b57136deaffc33b05aca960cf2ed9904648db25f..8bcef6c87e00df41c1e51537aea06a6afc83ebe1 100644 (file)
@@ -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 <sys/stat.h>
 extern int     pgwin32_safestat(const char *path, struct stat *buf);
 #define stat(a,b) pgwin32_safestat(a,b)
index 1c795a47c7d021f8c17e7069432afcf99d2c1714..9d02dec57199e8e9b72775be2ec3ca3f4569553c 100644 (file)
@@ -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
index 0c1aeb3cc96adde7722e9dc73ff4821fde5fb3f6..bff1ef900d5f5011e1468ef522b18e8957d5aed8 100644 (file)
@@ -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');