[openssh-commits] [openssh] 01/01: sync fmt_scaled.c
git+noreply at mindrot.org
git+noreply at mindrot.org
Mon May 14 14:40:42 AEST 2018
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit 32e4e94e1511fe0020fbfbb62399d31b2d22a801
Author: Damien Miller <djm at mindrot.org>
Date: Mon May 14 14:40:08 2018 +1000
sync fmt_scaled.c
revision 1.17
date: 2018/05/14 04:39:04; author: djm; state: Exp; lines: +5 -2;
commitid: 53zY8GjViUBnWo8Z;
constrain fractional part to [0-9] (less confusing to static analysis); ok ian@
---
openbsd-compat/fmt_scaled.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/openbsd-compat/fmt_scaled.c b/openbsd-compat/fmt_scaled.c
index f68f2412..2f76ef93 100644
--- a/openbsd-compat/fmt_scaled.c
+++ b/openbsd-compat/fmt_scaled.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fmt_scaled.c,v 1.16 2017/03/16 02:40:46 dtucker Exp $ */
+/* $OpenBSD: fmt_scaled.c,v 1.17 2018/05/14 04:39:04 djm Exp $ */
/*
* Copyright (c) 2001, 2002, 2003 Ian F. Darwin. All rights reserved.
@@ -246,12 +246,15 @@ fmt_scaled(long long number, char *result)
fract = (10 * fract + 512) / 1024;
/* if the result would be >= 10, round main number */
- if (fract == 10) {
+ if (fract >= 10) {
if (number >= 0)
number++;
else
number--;
fract = 0;
+ } else if (fract < 0) {
+ /* shouldn't happen */
+ fract = 0;
}
if (number == 0)
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list