[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/18] error-report: fix g_date_time_format assertion
From: |
Paolo Bonzini |
Subject: |
[PULL 01/18] error-report: fix g_date_time_format assertion |
Date: |
Thu, 28 Apr 2022 08:53:18 +0200 |
From: Haiyue Wang <haiyue.wang@intel.com>
The 'g_get_real_time' returns the number of microseconds since January
1, 1970 UTC, but 'g_date_time_new_from_unix_utc' needs the number of
seconds, so it will cause the invalid time input:
(process:279642): GLib-CRITICAL (recursed) **: g_date_time_format: assertion
'datetime != NULL' failed
Call function 'g_date_time_new_now_utc' instead, it has the same result
as 'g_date_time_new_from_unix_utc(g_get_real_time() / G_USEC_PER_SEC)';
Fixes: 73dab893b569 ("error-report: replace deprecated g_get_current_time()
with glib >= 2.62")
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220424105036.291370-1-haiyue.wang@intel.com>
---
util/error-report.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/error-report.c b/util/error-report.c
index dbadaf206d..5edb2e6040 100644
--- a/util/error-report.c
+++ b/util/error-report.c
@@ -173,7 +173,7 @@ static char *
real_time_iso8601(void)
{
#if GLIB_CHECK_VERSION(2,62,0)
- g_autoptr(GDateTime) dt = g_date_time_new_from_unix_utc(g_get_real_time());
+ g_autoptr(GDateTime) dt = g_date_time_new_now_utc();
/* ignore deprecation warning, since GLIB_VERSION_MAX_ALLOWED is 2.56 */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
--
2.35.1
- [PULL 00/18] Misc QEMU patches for 2022-04-28, Paolo Bonzini, 2022/04/28
- [PULL 01/18] error-report: fix g_date_time_format assertion,
Paolo Bonzini <=
- [PULL 03/18] remove -writeconfig, Paolo Bonzini, 2022/04/28
- [PULL 07/18] qga: wixl: get path to sysroot from pkg-config as intended, Paolo Bonzini, 2022/04/28
- [PULL 09/18] configure: gcov should not exclude fortify-source, Paolo Bonzini, 2022/04/28
- [PULL 10/18] configure: move --enable/--disable-debug-info to second option parsing pass, Paolo Bonzini, 2022/04/28
- [PULL 02/18] configure: make fortify_source=yes by default, Paolo Bonzini, 2022/04/28
- [PULL 04/18] i386: pcmpestr 64-bit sign extension bug, Paolo Bonzini, 2022/04/28
- [PULL 05/18] meson: show final set of compiler flags, Paolo Bonzini, 2022/04/28
- [PULL 06/18] configure: remove dead code, Paolo Bonzini, 2022/04/28
- [PULL 08/18] configure: pc-bios/qemu-icon.bmp does not exist, Paolo Bonzini, 2022/04/28
- [PULL 14/18] meson, configure: move usbfs test to meson, Paolo Bonzini, 2022/04/28