summary refs log tree commit diff stats
path: root/util/error.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-05-28 14:27:47 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2025-06-05 20:24:51 +0200
commite8fb9c91a3ea437bdddd1819e180f36112e41ae1 (patch)
treebc0a3a39d9ac0e4bc7d64a9e282a2bf0bdbb284b /util/error.c
parent230a4894f45eac5fbd6bea8dc0dd54f84cf6c0fa (diff)
downloadfocaccia-qemu-e8fb9c91a3ea437bdddd1819e180f36112e41ae1.tar.gz
focaccia-qemu-e8fb9c91a3ea437bdddd1819e180f36112e41ae1.zip
util/error: make func optional
The function name is not available in Rust, so make it optional.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/error.c')
-rw-r--r--util/error.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/util/error.c b/util/error.c
index 3449ecc0b9..daea2142f3 100644
--- a/util/error.c
+++ b/util/error.c
@@ -24,8 +24,13 @@ Error *error_warn;
 static void error_handle(Error **errp, Error *err)
 {
     if (errp == &error_abort) {
-        fprintf(stderr, "Unexpected error in %s() at %.*s:%d:\n",
-                err->func, err->src_len, err->src, err->line);
+        if (err->func) {
+            fprintf(stderr, "Unexpected error in %s() at %.*s:%d:\n",
+                    err->func, err->src_len, err->src, err->line);
+        } else {
+            fprintf(stderr, "Unexpected error at %.*s:%d:\n",
+		    err->src_len, err->src, err->line);
+        }
         error_report("%s", error_get_pretty(err));
         if (err->hint) {
             error_printf("%s", err->hint->str);