xref: /OK3568_Linux_fs/buildroot/package/xen/0003-libs-light-fix-tv_sec-printf-format.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From a8ac01aa3e3ea5e6a9a1620aa8fa7e9da3458120 Mon Sep 17 00:00:00 2001
2From: Manuel Bouyer <bouyer@netbsd.org>
3Date: Tue, 26 Jan 2021 23:47:55 +0100
4Subject: [PATCH] libs/light: fix tv_sec printf format
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Don't assume tv_sec is a unsigned long, it is 64 bits on NetBSD 32 bits.
10Use %jd and cast to (intmax_t) instead
11
12Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
13Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
14[Retrieved (and backported) from:
15https://gitlab.com/xen-project/xen/-/commit/a8ac01aa3e3ea5e6a9a1620aa8fa7e9da3458120]
16Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
17---
18 tools/libs/light/libxl_create.c | 8 ++++----
19 1 file changed, 4 insertions(+), 4 deletions(-)
20
21diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
22index 8616113e72..9848d65f36 100644
23--- a/tools/libxl/libxl_create.c
24+++ b/tools/libxl/libxl_create.c
25@@ -496,7 +496,7 @@ int libxl__domain_build(libxl__gc *gc,
26         vments[2] = "image/ostype";
27         vments[3] = "hvm";
28         vments[4] = "start_time";
29-        vments[5] = GCSPRINTF("%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
30+        vments[5] = GCSPRINTF("%jd.%02d", (intmax_t)start_time.tv_sec,(int)start_time.tv_usec/10000);
31
32         localents = libxl__calloc(gc, 13, sizeof(char *));
33         i = 0;
34@@ -535,7 +535,7 @@ int libxl__domain_build(libxl__gc *gc,
35         vments[i++] = "image/kernel";
36         vments[i++] = (char *) state->pv_kernel.path;
37         vments[i++] = "start_time";
38-        vments[i++] = GCSPRINTF("%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
39+        vments[i++] = GCSPRINTF("%jd.%02d", (intmax_t)start_time.tv_sec,(int)start_time.tv_usec/10000);
40         if (state->pv_ramdisk.path) {
41             vments[i++] = "image/ramdisk";
42             vments[i++] = (char *) state->pv_ramdisk.path;
43@@ -1502,7 +1502,7 @@ static void domcreate_stream_done(libxl__egc *egc,
44         vments[2] = "image/ostype";
45         vments[3] = "hvm";
46         vments[4] = "start_time";
47-        vments[5] = GCSPRINTF("%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
48+        vments[5] = GCSPRINTF("%jd.%02d", (intmax_t)start_time.tv_sec,(int)start_time.tv_usec/10000);
49         break;
50     case LIBXL_DOMAIN_TYPE_PV:
51         vments = libxl__calloc(gc, 11, sizeof(char *));
52@@ -1512,7 +1512,7 @@ static void domcreate_stream_done(libxl__egc *egc,
53         vments[i++] = "image/kernel";
54         vments[i++] = (char *) state->pv_kernel.path;
55         vments[i++] = "start_time";
56-        vments[i++] = GCSPRINTF("%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
57+        vments[i++] = GCSPRINTF("%jd.%02d", (intmax_t)start_time.tv_sec,(int)start_time.tv_usec/10000);
58         if (state->pv_ramdisk.path) {
59             vments[i++] = "image/ramdisk";
60             vments[i++] = (char *) state->pv_ramdisk.path;
61--
62GitLab
63
64