[Libguestfs] [PATCH 2/2] copy-in: error out early if the localpath does not exist (RHBZ#1267032)
Richard W.M. Jones
rjones at redhat.com
Tue Sep 29 11:55:31 UTC 2015
On Tue, Sep 29, 2015 at 11:38:52AM +0200, Pino Toscano wrote:
> ---
> src/copy-in-out.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/src/copy-in-out.c b/src/copy-in-out.c
> index 0dd8cd3..2b1e4d4 100644
> --- a/src/copy-in-out.c
> +++ b/src/copy-in-out.c
> @@ -47,6 +47,12 @@ guestfs_impl_copy_in (guestfs_h *g, const char *localpath, const char *remotedir
> char buf[buf_len];
> const char *dirname, *basename;
> CLEANUP_FREE char *tar_buf = NULL;
> + struct stat statbuf;
> +
> + if (stat (localpath, &statbuf) == -1) {
> + error (g, _("source '%s' does not exist (or cannot be read)"), localpath);
> + return -1;
> + }
>
> int remote_is_dir = guestfs_is_dir (g, remotedir);
> if (remote_is_dir == -1)
NACK. See the patch series I just posted.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
More information about the Libguestfs
mailing list