summaryrefslogtreecommitdiff
path: root/debug/tst-chk1.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-11-13 03:13:00 +0000
committerUlrich Drepper <drepper@redhat.com>2004-11-13 03:13:00 +0000
commita9055cab7ac609b96984179194c7a2ec410c8e2b (patch)
treed7bbccb32e96d87220932549049a48f3eb5c3dad /debug/tst-chk1.c
parent1327439fc6ef182c3ab8c69a55d3bee15b3c62a7 (diff)
Update.
2004-11-12 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/libc_fatal.c: Add new function __libc_message which performs the printing and simple format string handling. The string is written to tty, stderr, syslog in this order, stopping after the first successful output. (__libc_fatal): Call __libc_message. * include/stdio.h: Declare __libc_message. * malloc/malloc.c (malloc_printerr): Use __libc_message. * debug/chk_fail.c: Also print message with __libc_message. * debug/test-strcpy_chk.c: Ensure that debug messages are not printed to the terminal or stderr. * debug/tst-chk1.c: Likewise. * posix/Makefile: Remove gpl2lgpl variable.
Diffstat (limited to 'debug/tst-chk1.c')
-rw-r--r--debug/tst-chk1.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c
index fb2074d0bf..37320c3514 100644
--- a/debug/tst-chk1.c
+++ b/debug/tst-chk1.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <fcntl.h>
+#include <paths.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
@@ -106,6 +108,17 @@ do_test (void)
sigaction (SIGABRT, &sa, NULL);
+ /* Avoid all the buffer overflow messages on stderr. */
+ int fd = open (_PATH_DEVNULL, O_WRONLY);
+ if (fd == -1)
+ close (STDERR_FILENO);
+ else
+ {
+ dup2 (fd, STDERR_FILENO);
+ close (fd);
+ }
+ setenv ("LIBC_FATAL_STDERR_", "1", 1);
+
struct A { char buf1[9]; char buf2[1]; } a;
printf ("Test checking routines at fortify level %d\n",