提交 d7d9b528 编写于 作者: B Blue Swirl

Fix OpenBSD build warning

Fix this warning:
  CC    savevm.o
/src/qemu/savevm.c: In function `do_savevm':
/src/qemu/savevm.c:1900: warning: passing arg 1 of `localtime_r' from incompatible pointer type

It looks like on OpenBSD the type of tv_sec in struct timeval is still
'long' instead of time_t as in most other OS. Fix by adding a cast.
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 b76da7e3
......@@ -1897,7 +1897,8 @@ void do_savevm(Monitor *mon, const QDict *qdict)
ptm = localtime(&tb.time);
strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", ptm);
#else
localtime_r(&tv.tv_sec, &tm);
/* cast below needed for OpenBSD where tv_sec is still 'long' */
localtime_r((const time_t *)&tv.tv_sec, &tm);
strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", &tm);
#endif
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册