From: Kostiantyn Kostiuk <kkostiuk@redhat.com>
To: qemu-devel@nongnu.org
Cc: Michael Roth <michael.roth@amd.com>,
Yan Vugenfirer <yvugenfi@redhat.com>,
Kostiantyn Kostiuk <kkostiuk@redhat.com>
Subject: [PATCH 1/2] qga-vss: Replace asserts with condition and report error
Date: Mon, 25 Aug 2025 17:52:40 +0300 [thread overview]
Message-ID: <20250825145241.170717-2-kkostiuk@redhat.com> (raw)
In-Reply-To: <20250825145241.170717-1-kkostiuk@redhat.com>
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
---
qga/vss-win32/requester.cpp | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index 4401d55e3a..bc260abb96 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -347,7 +347,12 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
goto out;
}
- assert(pCreateVssBackupComponents != NULL);
+ if (!pCreateVssBackupComponents) {
+ err_set(errset, (HRESULT)ERROR_PROC_NOT_FOUND,
+ "CreateVssBackupComponents proc address absent. Did you call requester_init()?");
+ goto out;
+ }
+
hr = pCreateVssBackupComponents(&vss_ctx.pVssbc);
if (FAILED(hr)) {
err_set(errset, hr, "failed to create VSS backup components");
@@ -579,8 +584,16 @@ void requester_thaw(int *num_vols, void *mountpints, ErrorSet *errset)
/* Tell the provider that the snapshot is finished. */
SetEvent(vss_ctx.hEventThaw);
- assert(vss_ctx.pVssbc);
- assert(vss_ctx.pAsyncSnapshot);
+ if (!vss_ctx.pVssbc) {
+ err_set(errset, (HRESULT)VSS_E_BAD_STATE,
+ "CreateVssBackupComponents is missing. Did you freeze the volumes?");
+ return;
+ }
+ if (!vss_ctx.pAsyncSnapshot) {
+ err_set(errset, (HRESULT)VSS_E_BAD_STATE,
+ "AsyncSnapshot set is missing. Did you freeze the volumes?");
+ return;
+ }
HRESULT hr = WaitForAsync(vss_ctx.pAsyncSnapshot);
switch (hr) {
--
2.50.1
next prev parent reply other threads:[~2025-08-25 14:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 14:52 [PATCH 0/2] qga-vss: Misc cleanup Kostiantyn Kostiuk
2025-08-25 14:52 ` Kostiantyn Kostiuk [this message]
2025-08-26 9:08 ` [PATCH 1/2] qga-vss: Replace asserts with condition and report error Yan Vugenfirer
2025-08-25 14:52 ` [PATCH 2/2] qga-vss: Remove unused dependencies Kostiantyn Kostiuk
2025-08-26 5:29 ` Yan Vugenfirer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250825145241.170717-2-kkostiuk@redhat.com \
--to=kkostiuk@redhat.com \
--cc=michael.roth@amd.com \
--cc=qemu-devel@nongnu.org \
--cc=yvugenfi@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).