[libvirt] [PATCH] qemu: Check for existence of auto-generated socket path before removing

Martin Kletzander mkletzan at redhat.com
Wed Sep 16 12:58:39 UTC 2015


On Tue, Sep 15, 2015 at 05:03:45PM -0400, John Ferlan wrote:
>Commit id 'f1f68ca33' added code to remove the directory paths for
>auto-generated sockets, but that code could be called before the
>paths were created resulting in generating error messages from
>virFileDeleteTree indicating that the file doesn't exist. So just
>add a check before attemping the directory delete for existence.
>

Oh, I haven't checked that virFileDeleteTree() causes an error.  Since
we don't want "silent" versions functions (even though we have many :|
), ACK to this.  No race should happen, and if it does; no biggie.

>Signed-off-by: John Ferlan <jferlan at redhat.com>
>---
> src/qemu/qemu_process.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
>index ce2c70c..b55eb52 100644
>--- a/src/qemu/qemu_process.c
>+++ b/src/qemu/qemu_process.c
>@@ -5269,13 +5269,13 @@ void qemuProcessStop(virQEMUDriverPtr driver,
>
>     ignore_value(virAsprintf(&tmppath, "%s/domain-%s",
>                              cfg->libDir, vm->def->name));
>-    if (tmppath)
>+    if (tmppath && virFileExists(tmppath))
>         virFileDeleteTree(tmppath);
>     VIR_FREE(tmppath);
>
>     ignore_value(virAsprintf(&tmppath, "%s/domain-%s",
>                              cfg->channelTargetDir, vm->def->name));
>-    if (tmppath)
>+    if (tmppath && virFileExists(tmppath))
>         virFileDeleteTree(tmppath);
>     VIR_FREE(tmppath);
>
>--
>2.1.0
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150916/4065e6f8/attachment-0001.sig>


More information about the libvir-list mailing list