Seems that the original code was also broken of course, forking and
execing /bin/domainname is indeed a bit stupid, and the domainname
command is also specified (to the extent it is "specified" at all) to
return the NIS domain name.
But honestly, how many of the LibreOffice installations on Unix even
have the NIS domain name set? At least in my openSUSE 11.4 with fairly
default settings, the domainname command prints nothing. Neither does
it in my Mac OS X 10.7.2.
I guess the sane thing to do here is to 1) unravel the stack of static
functions in sal/osl/unx/socket.c and find out what public functions
they actually are used in; 2) if possible drop code that is not
needed; 3) and finally ponder what will break, if anything, if we just
don't bother with the NIS domain name. 4) If really necessary, then do
it right, as Lionel said:
The portable and strictly correct way seems to be to do a
DNS query on the result of gethostname() (gethostbyname or getaddrinfo
with AI_CANONNAME).
But in general we should avoid potentially pointless DNS calls. Let's
not risk having to wait for DNS timeouts in badly configured
situations. I think there has been bug reports of OOo and/or LO being
very slow to start in some cases, where the root cause has been some
DNS call timing out?
LibreOffice is an "office suite", not some Internet service software,
why would it need to know the exact canonical official hostname of the
machine it is running on (or some other machine)? Especially as many
"home" end-user machines certainly don't have any public official DNS
name anyway, at least not one the machine itself would know, but some
cable-modem-42651e7a3c.isp.example.com.
--tml
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice