On Wed, Aug 30, 2017 at 02:40:16PM -0500, Eric Blake wrote: > On 08/30/2017 11:56 AM, Jeff Cody wrote: > > We don't need libssh2 failure to be fatal (we could just opt to not > > register the driver on failure). But, it is probably a good idea to > > avoid external library calls during the block_init(), and call the > > libssh2 global init function on the first usage, returning any errors. > > > > Signed-off-by: Jeff Cody <jc...@redhat.com> > > --- > > block/ssh.c | 40 +++++++++++++++++++++++++++++----------- > > 1 file changed, 29 insertions(+), 11 deletions(-) > > > > > +static int ssh_state_init(BDRVSSHState *s, Error **errp) > > { > > + int ret; > > + > > + if (!ssh_libinit_called) { > > + ret = libssh2_init(0); > > + if (ret) { > > + error_setg(errp, "libssh2 initialization failed with %d", ret); > > + return ret; > > Do we know if this number is always positive or negative?
FWIW documentation says: "Returns 0 if succeeded, or a negative value for error." I was holding off on reviewing this patch in general since there's a libssh-based alternative driver under development, which should be better. 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