From: Blue Swirl Date: Thu, 9 Sep 2010 19:13:04 +0000 (+0000) Subject: Fix OpenBSD build warning X-Git-Tag: v0.14.0-rc0~695 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d7d9b528b105b9e27d9ffa5dd1f773d484a559b4;p=thirdparty%2Fqemu.git 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 --- diff --git a/savevm.c b/savevm.c index 4d9f822f27c..6fa7a5fe8e4 100644 --- a/savevm.c +++ b/savevm.c @@ -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 }