Signed-off-by: Wei Liu <[email protected]>
---
tools/libxl/libxl_x86.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
index 8cd15ca..bac0b8f 100644
--- a/tools/libxl/libxl_x86.c
+++ b/tools/libxl/libxl_x86.c
@@ -306,10 +306,16 @@ int libxl__arch_domain_create(libxl__gc *gc,
libxl_domain_config *d_config,
rtc_timeoffset = d_config->b_info.rtc_timeoffset;
if (libxl_defbool_val(d_config->b_info.localtime)) {
time_t t;
- struct tm *tm;
+ struct tm *tm, result;
t = time(NULL);
- tm = localtime(&t);
+ tm = localtime_r(&t, &result);
+
+ if (!tm) {
+ LOGE(ERROR, "Failed to call localtime_r");
+ ret = ERROR_FAIL;
+ goto out;
+ }
rtc_timeoffset += tm->tm_gmtoff;
}
@@ -335,6 +341,7 @@ int libxl__arch_domain_create(libxl__gc *gc,
libxl_domain_config *d_config,
}
}
+out:
return ret;
}
--
1.9.1
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel