about summary refs log tree commit diff
path: root/misc/tst-efgcvt.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-11-10 08:15:19 +0000
committerUlrich Drepper <drepper@redhat.com>1999-11-10 08:15:19 +0000
commitb9d3d9f726a79f0c1091e80cfb21e27eaed130c0 (patch)
treeb4bffa1c2f8ab000bc31b745dfbfab91f6410c4d /misc/tst-efgcvt.c
parent2864e767053317538feafa815046fff89e5a16be (diff)
downloadglibc-b9d3d9f726a79f0c1091e80cfb21e27eaed130c0.tar.gz
glibc-b9d3d9f726a79f0c1091e80cfb21e27eaed130c0.tar.xz
glibc-b9d3d9f726a79f0c1091e80cfb21e27eaed130c0.zip
Update.
1999-11-10  Andreas Jaeger  <aj@suse.de>

	* string/strsignal.c (strsignal): Correct check for snprintf
	return value.
	* argp/argp-fmtstream.c (__argp_fmtstream_printf): Likewise.

	* misc/efgcvt_r.c (APPEND): Correct check for too small buffer
	according to changed snprintf return value.
	Reported by Lawrence K. Chen <lchen@opentext.com>.

	* misc/tst-efgcvt.c (special): Add tests for a too small buffer
	for ecvt_r and fcvt_r.
Diffstat (limited to 'misc/tst-efgcvt.c')
-rw-r--r--misc/tst-efgcvt.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/misc/tst-efgcvt.c b/misc/tst-efgcvt.c
index cfbaa21cb1..74dd6bd8d3 100644
--- a/misc/tst-efgcvt.c
+++ b/misc/tst-efgcvt.c
@@ -120,9 +120,10 @@ test (testcase tests[], efcvt_func efcvt, const char *name)
 void
 special (void)
 {
-  int decpt, sign;
+  int decpt, sign, res;
   char *p;
-
+  char buf [1024];
+  
   p = ecvt (NAN, 10, &decpt, &sign);
   if (sign != 0 || strcmp (p, "nan") != 0)
     output_error ("ecvt", NAN, 10, "nan", 0, 0, p, decpt, sign);
@@ -135,6 +136,20 @@ special (void)
   (void) ecvt (123.456, 10000, &decpt, &sign);
   (void) fcvt (123.456, 10000, &decpt, &sign);
 
+  /* Some tests for for the reentrant functions.  */
+  /* Use a too small buffer.  */
+  res = ecvt_r (123.456, 10, &decpt, &sign, buf, 1);
+  if (res == 0)
+    {
+      printf ("ecvt_r with a too small buffer was succesful.\n");
+      ++error_count;
+    }
+  res = fcvt_r (123.456, 10, &decpt, &sign, buf, 1);
+  if (res == 0)
+    {
+      printf ("fcvt_r with a too small buffer was succesful.\n");
+      ++error_count;
+    }
 }