cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-fw_cfg-Improve-error-message-when-can-t-load-splash-.patch

Pablo Greco e6a3ae
From f11136998ed22e121b0a9df26f83e252bd5918fa Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: Markus Armbruster <armbru@redhat.com>
Pablo Greco e6a3ae
Date: Mon, 7 Oct 2019 07:35:06 +0100
Pablo Greco e6a3ae
Subject: [PATCH 13/22] fw_cfg: Improve error message when can't load splash
Pablo Greco e6a3ae
 file
Pablo Greco e6a3ae
MIME-Version: 1.0
Pablo Greco e6a3ae
Content-Type: text/plain; charset=UTF-8
Pablo Greco e6a3ae
Content-Transfer-Encoding: 8bit
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: Markus Armbruster <armbru@redhat.com>
Pablo Greco e6a3ae
Message-id: <20191007073509.5887-2-armbru@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 90978
Pablo Greco e6a3ae
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH v2 1/4] fw_cfg: Improve error message when can't load splash file
Pablo Greco e6a3ae
Bugzilla: 1607367
Pablo Greco e6a3ae
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
From: Li Qiang <liq3ea@gmail.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
read_splashfile() reports "failed to read splash file" without
Pablo Greco e6a3ae
further details. Get the details from g_file_get_contents(), and
Pablo Greco e6a3ae
include them in the error message. Also remove unnecessary 'res'
Pablo Greco e6a3ae
variable.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Pablo Greco e6a3ae
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Pablo Greco e6a3ae
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Pablo Greco e6a3ae
Message-Id: <1541052148-28752-1-git-send-email-liq3ea@gmail.com>
Pablo Greco e6a3ae
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Pablo Greco e6a3ae
(cherry picked from commit bed66336771ecdcb788d394bdd081a78b843e509)
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 hw/nvram/fw_cfg.c | 7 +++----
Pablo Greco e6a3ae
 1 file changed, 3 insertions(+), 4 deletions(-)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
Pablo Greco e6a3ae
index 2a0739d..d35ac7b 100644
Pablo Greco e6a3ae
--- a/hw/nvram/fw_cfg.c
Pablo Greco e6a3ae
+++ b/hw/nvram/fw_cfg.c
Pablo Greco e6a3ae
@@ -68,15 +68,14 @@ static char *read_splashfile(char *filename, gsize *file_sizep,
Pablo Greco e6a3ae
                              int *file_typep)
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
     GError *err = NULL;
Pablo Greco e6a3ae
-    gboolean res;
Pablo Greco e6a3ae
     gchar *content;
Pablo Greco e6a3ae
     int file_type;
Pablo Greco e6a3ae
     unsigned int filehead;
Pablo Greco e6a3ae
     int bmp_bpp;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-    res = g_file_get_contents(filename, &content, file_sizep, &err;;
Pablo Greco e6a3ae
-    if (res == FALSE) {
Pablo Greco e6a3ae
-        error_report("failed to read splash file '%s'", filename);
Pablo Greco e6a3ae
+    if (!g_file_get_contents(filename, &content, file_sizep, &err)) {
Pablo Greco e6a3ae
+        error_report("failed to read splash file '%s': %s",
Pablo Greco e6a3ae
+                     filename, err->message);
Pablo Greco e6a3ae
         g_error_free(err);
Pablo Greco e6a3ae
         return NULL;
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae