On Tue, Sep 29, 2015 at 06:18:39PM +0200, Pino Toscano wrote:
On Tuesday 29 September 2015 12:55:31 Richard W.M. Jones wrote:
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.
Would patch #2 be acceptable anyway, as simple starting check?
Would it be better for it to use perrorf() there? I'm trying to think of a case where localpath could not be stat'ed, and yet tar would succeed, but I can't think of one. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v