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

index a05c7c66d8f78aedd7373c27591db020d1a35708..54e9fb6494d48a52f354dfd389131c759289d13f 100644 (file)
@@ -280,8 +280,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 8506c48ec7d52311fb44dd89a42047ed4786c8d3..d9689fd7f809542794db6eb56a721d5365f7555b 100644 (file)
@@ -20,7 +20,7 @@ SO_MAJOR_VERSION= 5
 SO_MINOR_VERSION= 0
 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 421629db52537d18f48e8d9c757ca855bf02c921..9f4a3c11e872099ddc81555afc7794e55f19d0fe 100644 (file)
@@ -79,6 +79,7 @@ if ($solution->{options}->{tcl}) {
 
 my $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('wldap32.lib') if ($solution->{options}->{ldap});