about summary refs log tree commit diff
path: root/misc/tst-error1.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-07-19 23:46:55 +0000
committerUlrich Drepper <drepper@redhat.com>2005-07-19 23:46:55 +0000
commit10ffcd52f0578b13b48bdf84e73759353b29b673 (patch)
treead0a30eb784d7b5d2cb83c7bd12c4303f5901fac /misc/tst-error1.c
parent401a9ec9cad6fe21a6471f926152dbaff64d2212 (diff)
downloadglibc-10ffcd52f0578b13b48bdf84e73759353b29b673.tar.gz
glibc-10ffcd52f0578b13b48bdf84e73759353b29b673.tar.xz
glibc-10ffcd52f0578b13b48bdf84e73759353b29b673.zip
* stdio-common/Makefile (aux): Add fxprintf.
	* stdio-common/fxprintf.c: New file.
	* include/stdio.h: Add declaration for stdio.h.
	* argp/argp-fmtstream.c: Use __fxprintf instead of inline stream
	orientation test and two separate function calls.
	* argp/argp-help.c: Likewise.
	* assert/assert-perr.c: Likewise.
	* assert/assert.c: Likewise.
	* gmon/gmon.c: Likewise.
	* inet/rcmd.c: Likewise.
	* malloc/obstack.c: Likewise.
	* misc/error.c: Likewise.
	* misc/getpass.c: Likewise.
	* posix/getopt.c: Likewise.
	* resolv/res_hconf.c: Likewise.
	* stdio-common/perror.c: Likewise.
	* stdio-common/psignal.c: Likewise.
	* stdlib/fmtmsg.c: Likewise.
	* sunrpc/auth_unix.c: Likewise.
	* sunrpc/clnt_perr.c: Likewise.
	* sunrpc/clnt_tcp.c: Likewise.
	* sunrpc/clnt_udp.c: Likewise.
	* sunrpc/clnt_unix.c: Likewise.
	* sunrpc/svc_simple.c: Likewise.
	* sunrpc/svc_tcp.c: Likewise.
	* sunrpc/svc_udp.c: Likewise.
	* sunrpc/svc_unix.c: Likewise.
	* sunrpc/xdr.c: Likewise.
	* sunrpc/xdr_array.c: Likewise.
	* sunrpc/xdr_rec.c: Likewise.
	* sunrpc/xdr_ref.c: Likewise.
	* sysdeps/generic/wordexp.c: Likewise.

	* misc/Makefile: Add rules to build and run tst-error1.
	* misc/tst-error1.c: New file.
	* misc/error.c: Fix memory leak and possibly endless loop.
Diffstat (limited to 'misc/tst-error1.c')
-rw-r--r--misc/tst-error1.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/misc/tst-error1.c b/misc/tst-error1.c
new file mode 100644
index 0000000000..e84843ed2f
--- /dev/null
+++ b/misc/tst-error1.c
@@ -0,0 +1,26 @@
+#include <error.h>
+#include <mcheck.h>
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+
+static int
+do_test (int argc, char *argv[])
+{
+  mtrace ();
+  (void) freopen (argc == 1 ? "/dev/stdout" : argv[1], "a", stderr);
+  /* Orient the stream.  */
+  fwprintf (stderr, L"hello world\n");
+  char buf[20000];
+  static const char str[] = "hello world! ";
+  for (int i = 0; i < 1000; ++i)
+    memcpy (&buf[i * (sizeof (str) - 1)], str, sizeof (str));
+  error (0, 0, str);
+  error (0, 0, buf);
+  error (0, 0, buf);
+  error (0, 0, str);
+  return 0;
+}
+
+#define TEST_FUNCTION do_test (argc, argv)
+#include "../test-skeleton.c"