summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2014-08-05 21:53:37 +0000
committerSteve Huston <shuston@riverace.com>2014-08-05 21:53:37 +0000
commit8fb3fa969b6a4c0aa29a9415d01ea0d86a5e441e (patch)
treee35d52a88ef927a1fea7bd431179189eea725d84
parent80460fd691fbc007370abefa2319ab583ab4f853 (diff)
downloadATCD-8fb3fa969b6a4c0aa29a9415d01ea0d86a5e441e.tar.gz
ChangeLogTag:Tue Aug 5 21:49:12 UTC 2014 Steve Huston <shuston@riverace.com>
-rw-r--r--ACE/ChangeLog9
-rw-r--r--ACE/ace/OS_NS_stdio.inl4
-rw-r--r--ACE/ace/Process.cpp8
3 files changed, 19 insertions, 2 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index 24383398046..51fad58486e 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,12 @@
+Tue Aug 5 21:49:12 UTC 2014 Steve Huston <shuston@riverace.com>
+
+ * ace/Process.cpp (setenv): Use the correct format string for
+ non-Windows wide-char builds. Fixes Bugzilla 4176.
+
+ * ace/OS_NS_stdio.inl (vsnprintf): When trying to adapt C99 vswprintf
+ to return a required destination memory area, don't be fooled by a
+ real error such as formatting errors. Fixes Bugzilla 4177.
+
Tue Aug 5 17:14:04 UTC 2014 Steve Huston <shuston@riverace.com>
* ace/Process.cpp (setenv): Correctly re-process variable arg list if
diff --git a/ACE/ace/OS_NS_stdio.inl b/ACE/ace/OS_NS_stdio.inl
index 60031b4fd63..8e44c5a8f64 100644
--- a/ACE/ace/OS_NS_stdio.inl
+++ b/ACE/ace/OS_NS_stdio.inl
@@ -1115,7 +1115,9 @@ ACE_OS::vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_lis
// was available. Earlier variants of the vsnprintf() (e.g. UNIX98)
// defined it to return -1. This method follows the C99 standard,
// but needs to guess at the value; uses maxlen + 1.
- if (result == -1)
+ // Note that a formatting failure also returns -1. On RHEL this is
+ // errno EINVAL. Don't indicate a simple memory shortage for that.
+ if (result == -1 && errno != EINVAL)
result = static_cast <int> (maxlen + 1);
return result;
diff --git a/ACE/ace/Process.cpp b/ACE/ace/Process.cpp
index 0b41e371af3..6a6f51a93b9 100644
--- a/ACE/ace/Process.cpp
+++ b/ACE/ace/Process.cpp
@@ -994,9 +994,15 @@ ACE_Process_Options::setenv (const ACE_TCHAR *variable_name,
ACE_NEW_RETURN (newformat, ACE_TCHAR[buflen], -1);
ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> safe_newformat (newformat);
+# if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
+ const ACE_TCHAR *fmt = ACE_TEXT ("%ls=%ls");
+# else
+ const ACE_TCHAR *fmt = ACE_TEXT ("%s=%s");
+# endif
+
// Add in the variable name.
ACE_OS::sprintf (safe_newformat.get (),
- ACE_TEXT ("%s=%s"),
+ fmt,
variable_name,
format);