View | Details | Raw Unified | Return to bug 2769 | Differences between
and this patch

Collapse All | Expand All

(-)a/openbsd-compat/fmt_scaled.c (-2 / +3 lines)
Lines 246-258 fmt_scaled(long long number, char *result) Link Here
246
246
247
	fract = (10 * fract + 512) / 1024;
247
	fract = (10 * fract + 512) / 1024;
248
	/* if the result would be >= 10, round main number */
248
	/* if the result would be >= 10, round main number */
249
	if (fract == 10) {
249
	if (fract >= 10) {
250
		if (number >= 0)
250
		if (number >= 0)
251
			number++;
251
			number++;
252
		else
252
		else
253
			number--;
253
			number--;
254
		fract = 0;
254
		fract = 0;
255
	}
255
	} else if (fract < 0)
256
		fract = 0; /* shouldn't happen */
256
257
257
	if (number == 0)
258
	if (number == 0)
258
		strlcpy(result, "0B", FMT_SCALED_STRSIZE);
259
		strlcpy(result, "0B", FMT_SCALED_STRSIZE);

Return to bug 2769