Re: [chrony-dev] [PATCH] Fix precision loss warnings

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]



On Sun, 9 Aug 2015, Bryan Christianson wrote:


On 9/08/2015, at 5:57 pm, Håkan Johansson <f96hajo@xxxxxxxxxxx> wrote:


Curiosity:  recvfrom and sendto returns ssize_t (which is 64 bits on some
platforms), so this would invite for code that could make mistakes, by cutting the values.

Should the return value not rather be put in a ssize_t or some other variable that is large enough?  And if really casted down, first be checked that they fit.

The result was being truncated (on some platforms) prior to this patch (assigning to variable declared as int) so there is no net change. I don't thing chrony will ever return more than 2 billion bytes in a single read, but maybe that would be a better way to do it. Is ssize_t available on all platforms that chrony supports? I didn't know so chose to maintain the status quo in terms of variable sizes.

I am just a bystander, so it is a question for Miroslav.

// Håkan


--
Bryan Christianson
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/