On 5/13/22 9:54 AM, Michal Privoznik wrote: > Calling virDomainRestoreFlags() with no typed params results in > an error in open() because it tries to open a NULL path. > Obviously, this is wrong and path to restore from must be > provided, at least for now until other sources of restore are > introduced. Then this limitation can be relaxed. > > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > --- > src/libvirt-domain.c | 4 +++- > src/qemu/qemu_driver.c | 6 ++++++ > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c > index 208c2438fe..a32630a6e9 100644 > --- a/src/libvirt-domain.c > +++ b/src/libvirt-domain.c > @@ -1190,7 +1190,9 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml, > * @nparams: number of restore parameters > * @flags: bitwise-OR of virDomainSaveRestoreFlags > * > - * This method extends virDomainRestoreFlags by adding parameters. > + * This method extends virDomainRestoreFlags by adding parameters. For > + * now, VIR_DOMAIN_SAVE_PARAM_FILE is required but this requirement may > + * be lifted in the future. > * > * Returns 0 in case of success and -1 in case of failure. > * > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > index 0b31c73bb9..702fd0239c 100644 > --- a/src/qemu/qemu_driver.c > +++ b/src/qemu/qemu_driver.c > @@ -5967,6 +5967,12 @@ qemuDomainRestoreParams(virConnectPtr conn, > VIR_DOMAIN_SAVE_PARAM_DXML, &dxml) < 0) > return -1; > > + if (!path) { Similarly to before, should the check be (!path || !path[0]) ? Thanks C > + virReportError(VIR_ERR_INVALID_ARG, "%s", > + _("missing path to restore from")); > + return -1; > + } > + > ret = qemuDomainRestoreInternal(conn, path, dxml, flags, > virDomainRestoreParamsEnsureACL); > return ret; >