[PATCH 1/5] virCommandAddArg: Don't abort on invalid input

Peter Krempa pkrempa at redhat.com
Mon Nov 23 10:59:12 UTC 2020


Commit 912c6b22fc622cd7c7d29c7f8eaeb816b266daac added abort() when the
'val' parameter is NULL along with setting the error variable for the
command. We don't want to abort in this case, just set the error.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/vircommand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 9a4f3d7f32..5117467c1d 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -1503,7 +1503,7 @@ virCommandAddArg(virCommandPtr cmd, const char *val)

     if (val == NULL) {
         cmd->has_error = EINVAL;
-        abort();
+        return;
     }

     arg = g_strdup(val);
-- 
2.28.0




More information about the libvir-list mailing list