summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-09-28 14:56:29 +0200
committerMichael Stahl <mstahl@redhat.com>2015-09-28 15:10:06 +0200
commitcc5843daeb0deed57755036daa0917329e79a3a2 (patch)
tree037673b3943ee432fe2def6bc0282f4615d8c623 /framework
parent505933da253a9d1d5dd00f2243c714f8ec8aa313 (diff)
framework: remove obsolete Linux libc5 support
Change-Id: I42f7f961615f61002d6c0cce5b7eb44447ba5a64
Diffstat (limited to 'framework')
-rw-r--r--framework/source/fwi/helper/networkdomain.cxx19
1 files changed, 5 insertions, 14 deletions
diff --git a/framework/source/fwi/helper/networkdomain.cxx b/framework/source/fwi/helper/networkdomain.cxx
index bbb2a1526b0d..c52c2ec44bc4 100644
--- a/framework/source/fwi/helper/networkdomain.cxx
+++ b/framework/source/fwi/helper/networkdomain.cxx
@@ -132,26 +132,17 @@ static rtl_uString *getDomainName()
/* Initialize and assume failure */
rtl_uString *ustrDomainName = NULL;
- char *pBuffer;
- int result;
- size_t nBufSize = 0;
+ char buffer[256]; // actually the man page says 65 bytes should be enough
- do
- {
- nBufSize += 256; /* Increase buffer size by steps of 256 bytes */
- pBuffer = static_cast<char *>(alloca( nBufSize ));
- result = getdomainname( pBuffer, nBufSize );
- /* If buffersize in not large enough -1 is returned and errno
- is set to EINVAL. This only applies to libc. With glibc the name
- is truncated. */
- } while ( -1 == result && EINVAL == errno );
+ /* If buffersize is not large enough the name is truncated. */
+ int const result = getdomainname( &buffer[0], SAL_N_ELEMENTS(buffer) );
if ( 0 == result )
{
rtl_string2UString(
&ustrDomainName,
- pBuffer,
- strlen( pBuffer ),
+ &buffer[0],
+ strlen( &buffer[0] ),
osl_getThreadTextEncoding(),
OSTRING_TO_OUSTRING_CVTFLAGS );
}