summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdAH.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCmdAH.c')
-rw-r--r--generic/tclCmdAH.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index 14b5e66..c2fae75 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdAH.c,v 1.62 2005/06/07 09:04:00 dkf Exp $
+ * RCS: @(#) $Id: tclCmdAH.c,v 1.63 2005/06/17 23:41:03 dkf Exp $
*/
#include "tclInt.h"
@@ -2221,15 +2221,22 @@ Tcl_FormatObjCmd(dummy, interp, objc, objv)
goto fmtError;
}
#if (LONG_MAX > INT_MAX)
- /*
- * Add the 'l' for long format type because we are on an
- * LP64 archtecture and we are really going to pass a long
- * argument to sprintf.
- */
- newPtr++;
- *newPtr = 0;
- newPtr[-1] = newPtr[-2];
- newPtr[-2] = 'l';
+ if (!useShort) {
+ /*
+ * Add the 'l' for long format type because we are on an
+ * LP64 archtecture and we are really going to pass a long
+ * argument to sprintf.
+ *
+ * Do not add this if we're going to pass in a short (i.e.
+ * if we've got an 'h' modifier already in the string); some
+ * libc implementations of sprintf() do not like it at all.
+ * [Bug 1154163]
+ */
+ newPtr++;
+ *newPtr = 0;
+ newPtr[-1] = newPtr[-2];
+ newPtr[-2] = 'l';
+ }
#endif /* LONG_MAX > INT_MAX */
whichValue = INT_VALUE;
size = 40 + precision;