Re: [chrony-dev] [PATCH] Fix precision loss warnings |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-dev] [PATCH] Fix precision loss warnings
- From: Bryan Christianson <bryan@xxxxxxxxxxxxx>
- Date: Sun, 9 Aug 2015 18:09:57 +1200
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=a0-2; h=Feedback-ID:X-Smtpcorp-Track:To:Message-Id:Date: From:Subject; bh=NK8+CdhLFHxBxBS0hQtAM06rMXPXAHeJNumVQjDhphU=; b=yQPjLSGGwY4u gRbaQj+Vn4WdGZwqdJ+O2ZvCJTPsWabvx4Ek5blvdxvi954bMob+u9Uj4/+JXrkDchO9u9BQ+cjQK 5wkGVck9HcgVO4rVo2UZpi5YdPQk0FrF35h5TJvE9Ihj42ht2YuQeCaWwze1sahX0gYssqDnqgtu/ Dfk1VmeIXZa6fXox1HseQcCp/F9Wpt9mxNz/9/rHGH6+G4UnKndn49zi2q0Ynbq6Essyl/Bs0ubx7 /rpYGHVCsshUQS5qwQqx6xZK+IkQ/236Rs84mPiyRV2IMZprrbNkXzIrjXis1qLP+1ynss9XJuyFP GdWsysPCBoNYbnI31Kva9Q==;
- Feedback-id: 149811m:149811acx33YQ:149811sxMO4uEV0E:SMTPCORP
> 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.
--
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.