[Libguestfs] [PATCH 2/2] copy-in: error out early if the localpath does not exist (RHBZ#1267032)

Pino Toscano ptoscano at redhat.com
Tue Sep 29 16:18:39 UTC 2015


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?

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20150929/d2013439/attachment.sig>


More information about the Libguestfs mailing list