Re: [libvirt] [PATCH] virConnectGetHostname: return a fully qualified hostname

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Lutterkort <lutter@xxxxxxxxxx> wrote:
> The attached patch makes virConnectGetHostname try a little harder to get a
> FQDN on systems where gethostname only returns a short name without a
> domain (which is pretty useless). The behavior is equivalent to 'hostname
> --fqdn'.

Hi David,

ACK, modulo some nits:

>> From 2ae57d0c8c68c453b3f9715fcc9f83af0ebe84a0 Mon Sep 17 00:00:00 2001
> From: David Lutterkort <lutter@xxxxxxxxxx>
> Date: Wed, 10 Dec 2008 18:34:39 -0800
> Subject: [PATCH] virConnectGetHostname: return a fully qualified hostname
...
> diff --git a/src/libvirt_sym.version.in b/src/libvirt_sym.version.in
> index de0bc4a..f02d9e0 100644
> --- a/src/libvirt_sym.version.in
> +++ b/src/libvirt_sym.version.in
> @@ -594,6 +594,7 @@ LIBVIRT_PRIVATE_@VERSION@ {
>  	virFileReadLimFD;
>  	virFileReadPid;
>  	virFileLinkPointsTo;
> +        virGetHostname;

While all the C code uses spaces for indentation,
this file uses TABs, so using spaces here looks weird when quoted.

>  	virParseNumber;
>  	virRun;
>  	virSkipSpaces;
...
> diff --git a/src/util.c b/src/util.c
...
> +char *virGetHostname(void)
> +{
> +    int r;
> +    char hostname[HOST_NAME_MAX+1], *str;
> +    struct hostent *he;
> +
> +    r = gethostname (hostname, HOST_NAME_MAX+1);

Avoid duplicating constants like that:

  s/HOST_NAME_MAX+1/sizeof hostname/

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]