libs/light: fix tv_sec fprintf format
PATCH 1/1 libs/light: fix tv_sec fprintf format
Don't assume tv_sec is a unsigned long, it is 64 bits on NetBSD 32 bits. Use %jd and cast to (intmax_t) instead
--- tools/libs/light/libxl_domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libs/light/libxl_domain.c +1 -1
@@ -1444,7 +1444,7 @@ static int libxl__mark_domid_recent(libxl__gc *gc, uint32_t domid) } } - r =fprintf (nf,"%lu %u\n" , ctxt.ts.tv_sec, domid); + r =fprintf (nf,"%jd %u\n" , (intmax_t )ctxt.ts.tv_sec, domid);if (r <0 ) {LOGED (ERROR , domid,"failed to write to '%s'" , new); goto out;
Signature · 1 line
2.32.0
Quoted 13 lines · Fabrice Fontaine
Don't assume
tv_secis a unsigned long, it is 64 bits on NetBSD 32 bits. Use %jd and cast to (intmax_t) insteadSigned-off-by Fabrice Fontaine <[email protected]>--- tools/libs/light/libxl_domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libs/light/libxl_domain.c +0
-0
tools/libs/light/libxl_domain.c static int libxl__mark_domid_recent(libxl__gc *gc, uint32_t domid) · line 1447
Quoted 5 lines
tools/libs/light/libxl_domain.c +1
-1@@ -1444,7 +1444,7 @@ static int libxl__mark_domid_recent(libxl__gc *gc, uint32_t domid) } } - r =fprintf (nf,"%lu %u\n" , ctxt.ts.tv_sec, domid); + r =fprintf (nf,"%jd %u\n" , (intmax_t )ctxt.ts.tv_sec, domid);
Any reason not to keep the unsigned attribute?
Juergen
Quoted 18 lines · Juergen Gross
Quoted 16 lines · Fabrice Fontaine
Don't assume
tv_secis a unsigned long, it is 64 bits on NetBSD 32 bits. Use %jd and cast to (intmax_t) insteadSigned-off-by Fabrice Fontaine <[email protected]>--- tools/libs/light/libxl_domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libs/light/libxl_domain.c +0
-0@@ -1444,7 +1444,7 @@ static int libxl__mark_domid_recent(libxl__gc *gc, uint32_t domid) } }
Quoted 4 lines
tools/libs/light/libxl_domain.c static int libxl__mark_domid_recent(libxl__gc *gc, uint32_t domid) · line 1447
Quoted 2 lines
tools/libs/light/libxl_domain.c +1
-1- r =fprintf (nf,"%lu %u\n" , ctxt.ts.tv_sec, domid); + r =fprintf (nf,"%jd %u\n" , (intmax_t )ctxt.ts.tv_sec, domid);Any reason not to keep the unsigned attribute?
Yes, for consistency, I applied the same fix that was merged seven months ago to libs/light/libxl_create.c:
https://gitlab.com/xen-project/xen/-/commit/a8ac01aa3e3ea5e6a9a1620aa8fa7e9da3458120
Quoted 3 lines
Juergen
Fabrice
Ian Jackson
Reviewed-byFabrice Fontaine writes ("Re: [PATCH] libs/light: fix tv_sec fprintf format"):
Quoted 19 lines · Juergen Gross
Quoted 18 lines · Fabrice Fontaine
Quoted 16 lines
Don't assume
tv_secis a unsigned long, it is 64 bits on NetBSD 32 bits. Use %jd and cast to (intmax_t) insteadSigned-off-by Fabrice Fontaine <[email protected]>--- tools/libs/light/libxl_domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libs/light/libxl_domain.c +0
-0@@ -1444,7 +1444,7 @@ static int libxl__mark_domid_recent(libxl__gc *gc, uint32_t domid) } }
Quoted 7 lines
Quoted 4 lines
tools/libs/light/libxl_domain.c static int libxl__mark_domid_recent(libxl__gc *gc, uint32_t domid) · line 1447
Quoted 2 lines
tools/libs/light/libxl_domain.c +1
-1- r =fprintf (nf,"%lu %u\n" , ctxt.ts.tv_sec, domid); + r =fprintf (nf,"%jd %u\n" , (intmax_t )ctxt.ts.tv_sec, domid);Any reason not to keep the unsigned attribute?
Yes, for consistency, I applied the same fix that was merged seven months ago to
libs/light/libxl_create.c:
https://gitlab.com/xen-project/xen/-/commit/a8ac01aa3e3ea5e6a9a1620aa8fa7e9da3458120
Thanks,
and pushed.
Ian.