]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
BSD vsnprintf: POSIX compliance
authorVMware, Inc <>
Sat, 28 May 2011 19:31:42 +0000 (12:31 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Sat, 28 May 2011 19:31:42 +0000 (12:31 -0700)
BSD printf doesn't comply with the POSIX specification for "%e" output.
There should only be two digits of exponent until the exponent is
larger than 99.

E5   -> E05
E15  -> E15
E115 -> E115

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/string/bsd_vsnprintf.c

index 96455a7e74a0eaa4209e8033b372fdc0b6b46878..205fd46d10da44bfcb80025405931297b12c4714 100644 (file)
@@ -1822,9 +1822,10 @@ BSDFmt_Exponent(char *p0, int exp, int fmtch)
       *p++ = '0';
    }
 
-   if (exp < 100) {
-      *p++ = '0';
-   }
+// See PR 704706: POSIX specifies that exponents < 100 only have 2 digits
+//   if (exp < 100) {
+//      *p++ = '0';
+//   }
 
    if (exp > 9) {
       do {