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

Re: [Libguestfs] [PATCH 2/2] customize: allow editing symlinked files



On Mon, Nov 09, 2015 at 06:36:16PM +0100, Pino Toscano wrote:
> Resolve also symlinks when checking whether a path passed to --edit is a
> file: the file editing code supports symlinks anyway (properly changes
> the target file, instead of overwrite the symlink with a real file), so
> it is safe to allow this operation in customize/builder.
> ---
>  customize/customize_run.ml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/customize/customize_run.ml b/customize/customize_run.ml
> index 054ee53..ed3c818 100644
> --- a/customize/customize_run.ml
> +++ b/customize/customize_run.ml
> @@ -201,7 +201,7 @@ exec >>%s 2>&1
>        if not (g#exists path) then
>          error (f_"%s does not exist in the guest") path;
>  
> -      if not (g#is_file path) then
> +      if not (g#is_file ~followsymlinks:true path) then
>          error (f_"%s is not a regular file in the guest") path;
>  
>        Perl_edit.edit_file g#ocaml_handle path expr
> -- 
> 2.1.0

ACK series.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW


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