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: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
b76da7e376
commit
d7d9b528b1
3
savevm.c
3
savevm.c
@ -1897,7 +1897,8 @@ void do_savevm(Monitor *mon, const QDict *qdict)
|
|||||||
ptm = localtime(&tb.time);
|
ptm = localtime(&tb.time);
|
||||||
strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", ptm);
|
strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", ptm);
|
||||||
#else
|
#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);
|
strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", &tm);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user