From: Andrew Dunstan Date: Wed, 16 Apr 2008 14:24:38 +0000 (+0000) Subject: Avoid using unnecessary pgwin32_safestat in libpq. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=1d7b83ecc32f796e1d0d8ddb632d04c57179341e;p=users%2Fbernd%2Fpostgres.git Avoid using unnecessary pgwin32_safestat in libpq. --- diff --git a/src/include/port.h b/src/include/port.h index a05c7c66d8..54e9fb6494 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -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 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 8506c48ec7..d9689fd7f8 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile @@ -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 diff --git a/src/tools/msvc/mkvcbuild.pl b/src/tools/msvc/mkvcbuild.pl index 421629db52..9f4a3c11e8 100644 --- a/src/tools/msvc/mkvcbuild.pl +++ b/src/tools/msvc/mkvcbuild.pl @@ -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});