aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2013-02-28 08:16:40 +0000
committerVincent Richard <[email protected]>2013-02-28 08:16:40 +0000
commitb9ace81807b5091713ff2418373a12249327c3a6 (patch)
tree86cf1dbe9f13a0658e651b25b9d3c16bf0e71ece
parentThrow exception when an invalid value type is set in a header field. (diff)
downloadvmime-b9ace81807b5091713ff2418373a12249327c3a6.tar.gz
vmime-b9ace81807b5091713ff2418373a12249327c3a6.zip
Fixed issue #26: strcpy_s not available on MinGW.
-rw-r--r--CMakeLists.txt1
-rw-r--r--src/platforms/windows/windowsHandler.cpp6
2 files changed, 7 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30e8220a..1bd70115 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -568,6 +568,7 @@ CHECK_FUNCTION_EXISTS(gmtime_s VMIME_HAVE_GMTIME_S)
CHECK_FUNCTION_EXISTS(gmtime_r VMIME_HAVE_GMTIME_R)
CHECK_FUNCTION_EXISTS(localtime_s VMIME_HAVE_LOCALTIME_S)
CHECK_FUNCTION_EXISTS(localtime_r VMIME_HAVE_LOCALTIME_R)
+CHECK_FUNCTION_EXISTS(strcpy_s VMIME_HAVE_STRCPY_S)
##############################################################################
diff --git a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp
index b188af64..99b52cdf 100644
--- a/src/platforms/windows/windowsHandler.cpp
+++ b/src/platforms/windows/windowsHandler.cpp
@@ -224,7 +224,13 @@ const vmime::string windowsHandler::getHostName() const
return hostname;
if (::strlen(hostname) == 0)
+ {
+#if VMIME_HAVE_STRCPY_S
::strcpy_s(hostname, "localhost");
+#else
+ ::strcpy(hostname, "localhost");
+#endif // VMIME_HAVE_STRCPY_S
+ }
// Try to get canonical name for the hostname
struct addrinfo hints;