framework/source/fwi/helper/networkdomain.cxx | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
New commits: commit cc5843daeb0deed57755036daa0917329e79a3a2 Author: Michael Stahl <mst...@redhat.com> Date: Mon Sep 28 14:56:29 2015 +0200 framework: remove obsolete Linux libc5 support Change-Id: I42f7f961615f61002d6c0cce5b7eb44447ba5a64 diff --git a/framework/source/fwi/helper/networkdomain.cxx b/framework/source/fwi/helper/networkdomain.cxx index bbb2a15..c52c2ec 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 ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits