[Libguestfs] [PATCH 2/2] mllib: hostname: add a newline in /etc/hostname

Richard W.M. Jones rjones at redhat.com
Wed Feb 12 17:37:40 UTC 2014


On Wed, Feb 12, 2014 at 03:30:53PM +0100, Pino Toscano wrote:
> /etc/hostname usually has an ending newline, so add it when changing it.
> ---
>  mllib/hostname.ml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mllib/hostname.ml b/mllib/hostname.ml
> index e1c5d4b..cffba6b 100644
> --- a/mllib/hostname.ml
> +++ b/mllib/hostname.ml
> @@ -79,7 +79,7 @@ and replace_line_in_file g filename key value =
>    g#write filename content
>  
>  and update_etc_hostname g hostname =
> -  g#write "/etc/hostname" hostname
> +  g#write "/etc/hostname" (hostname ^ "\n")
>  
>  and update_etc_machine_info g hostname =
>    replace_line_in_file g "/etc/machine-info" "PRETTY_HOSTNAME" hostname
> -- 
> 1.8.3.1

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list