1 diff --git desktop/source/app/lockfile.cxx desktop/source/app/lockfile.cxx
2 index b1bba75..a026115 100644
3 --- desktop/source/app/lockfile.cxx
4 +++ desktop/source/app/lockfile.cxx
6 #include <tools/prewin.h>
8 #include <tools/postwin.h>
12 #include <sal/types.h>
13 #include <osl/file.hxx>
14 @@ -53,6 +55,37 @@ using namespace ::rtl;
15 using namespace ::utl;
18 +static rtl::OString impl_getHostname()
23 + prevent windows from connecting to the net to get it's own
24 + hostname by using the netbios name
26 + sal_Int32 sz = MAX_COMPUTERNAME_LENGTH + 1;
27 + char* szHost = new char[sz];
28 + if (GetComputerName(szHost, (LPDWORD)&sz))
29 + aHost = OString(szHost);
31 + aHost = OString("UNKNOWN");
34 + /* Don't do dns lookup on Linux either */
35 + sal_Char pHostName[1024];
37 + if ( gethostname( pHostName, sizeof( pHostName ) - 1 ) == 0 )
39 + pHostName[sizeof( pHostName ) - 1] = '\0';
40 + aHost = OString( pHostName );
43 + aHost = OString("UNKNOWN");
51 // initialize static members...
52 @@ -158,25 +191,9 @@ namespace desktop {
54 ByteString aHost = aConfig.ReadKey( Hostkey() );
55 ByteString aUser = aConfig.ReadKey( Userkey() );
57 // lockfile from same host?
61 - prevent windows from connecting to the net to get it's own
62 - hostname by using the netbios name
64 - sal_Int32 sz = MAX_COMPUTERNAME_LENGTH + 1;
65 - char* szHost = new char[sz];
66 - if (GetComputerName(szHost, (LPDWORD)&sz))
67 - myHost = OString(szHost);
69 - myHost = OString("UNKNOWN");
72 - oslSocketResult sRes;
73 - myHost = OUStringToOString(
74 - SocketAddr::getLocalHostname( &sRes ), RTL_TEXTENCODING_ASCII_US );
76 + ByteString myHost( impl_getHostname() );
77 if (aHost == myHost) {
78 // lockfile by same UID
80 @@ -196,24 +213,7 @@ namespace desktop {
81 aConfig.SetGroup(Group());
87 - prevent windows from connecting to the net to get it's own
88 - hostname by using the netbios name
90 - sal_Int32 sz = MAX_COMPUTERNAME_LENGTH + 1;
91 - char* szHost = new char[sz];
92 - if (GetComputerName(szHost, (LPDWORD)&sz))
93 - aHost = OString(szHost);
95 - aHost = OString("UNKNOWN");
98 - oslSocketResult sRes;
99 - aHost = OUStringToOString(
100 - SocketAddr::getLocalHostname( &sRes ), RTL_TEXTENCODING_ASCII_US );
102 + ByteString aHost( impl_getHostname() );
105 aSecurity.getUserName( aUserName );