[PATCH 2/4] virutil: Do not use g_get_host_name() to obtain hostname

Ján Tomko jtomko at redhat.com
Wed Mar 10 18:47:12 UTC 2021


On a Tuesday in 2021, Michal Privoznik wrote:
>The problem is that g_get_host_name() caches the hostname in a
>thread local variable. Therefore, it doesn't reflect any
>subsequent hostname changes. While this might be acceptable for
>logs where the hostname is printed exactly once when the libvirtd
>starts up, it is not optimal for virGetHostnameImpl() which is
>what our public virConnectGetHostname() API calls.

>If the
>hostname at the moment of the first API invocation happens to be

s/be/start with/

>"localhost" or contains a dot, then no further hostname changes
>will ever be reflected.
>
>This reverts 26d9748ff11, partially.
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/util/virutil.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210310/349ff4ce/attachment-0001.sig>


More information about the libvir-list mailing list