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 6b57620a87b129e071c0b434e7e6122d0f18a338..a14c8dbbefd8e549054457a8cc053ad0ec44af43 100644 (file)
@@ -287,8 +287,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 62c6b70ea952ef125079ae5c8d7a872d58dc0400..cdcd89867545ba33f63b1a975357e50273e0d55f 100644 (file)
@@ -19,7 +19,7 @@ NAME= pq
 SO_MAJOR_VERSION= 5
 SO_MINOR_VERSION= 2
 
-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');