From: Michal Privoznik Date: Thu, 5 May 2016 07:07:50 +0000 (+0200) Subject: virNetServerClientNewPostExecRestart: Avoid align problems X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b17e610e1f1ff91c3b1df5a1e56291b7e0956701;p=libvirt.git virNetServerClientNewPostExecRestart: Avoid align problems I've noticed this while trying to compile libvirt on my arm box. CC rpc/libvirt_net_rpc_server_la-virnetserverclient.lo rpc/virnetserverclient.c: In function 'virNetServerClientNewPostExecRestart': rpc/virnetserverclient.c:516:45: error: cast increases required alignment of target type [-Werror=cast-align] (long long *) ×tamp) < 0) { ^ cc1: all warnings being treated as errors Problem is, @timestap is defined as time_t which is 32 bits long, and we are typecasting it to long long which is 64bits long. Solution is to make @timestamp type of long long. At the same time, we can make @conn_time in _virNetServerClient struct long long too. There is no need for it to be type of time_t. Signed-off-by: Michal Privoznik --- diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index d3a3a18f93..ef835072c1 100644 --- a/src/rpc/virnetserverclient.c +++ b/src/rpc/virnetserverclient.c @@ -90,7 +90,7 @@ struct _virNetServerClient * attribute, value of 0 (epoch time) is used to indicate we have no * information about their connection time. */ - time_t conn_time; + long long conn_time; /* Count of messages in the 'tx' queue, * and the server worker pool queue @@ -363,7 +363,7 @@ virNetServerClientNewInternal(unsigned long long id, #endif bool readonly, size_t nrequests_max, - time_t timestamp) + long long timestamp) { virNetServerClientPtr client; @@ -472,7 +472,7 @@ virNetServerClientPtr virNetServerClientNewPostExecRestart(virJSONValuePtr objec bool readonly; unsigned int nrequests_max; unsigned long long id; - time_t timestamp; + long long timestamp; if (virJSONValueObjectGetNumberInt(object, "auth", &auth) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -511,8 +511,7 @@ virNetServerClientPtr virNetServerClientNewPostExecRestart(virJSONValuePtr objec if (!virJSONValueObjectHasKey(object, "conn_time")) { timestamp = 0; } else { - if (virJSONValueObjectGetNumberLong(object, "conn_time", - (long long *) ×tamp) < 0) { + if (virJSONValueObjectGetNumberLong(object, "conn_time", ×tamp) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Malformed conn_time field in JSON " "state document"));