summaryrefslogtreecommitdiff
path: root/debug/chk_fail.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-11-12 16:57:17 +0000
committerJakub Jelinek <jakub@redhat.com>2004-11-12 16:57:17 +0000
commit8899fb784ab641a6c2aa755a3141718cd0e6f4af (patch)
tree6a97556066459bcfbaf4a9740de52ad0d026e020 /debug/chk_fail.c
parent8ae4ba1c6d925bdd110d6bbc04f6338065dd56ac (diff)
* debug/chk_fail.c: Include errno.h and string.h.
(__chk_fail): Write a short message to stderr. * debug/tst-chk1.c: Include fcntl.h. (do_test): Redirect stderr to /dev/null. * debug/test-strcpy_chk.c: Include fcntl.h. (test_main): Redirect stderr to /dev/null. (do_one_test, do_random_tests): Use printf instead of error.
Diffstat (limited to 'debug/chk_fail.c')
-rw-r--r--debug/chk_fail.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/debug/chk_fail.c b/debug/chk_fail.c
index 48848fbe35..70ffa9e40f 100644
--- a/debug/chk_fail.c
+++ b/debug/chk_fail.c
@@ -16,7 +16,9 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <abort-instr.h>
@@ -27,6 +29,8 @@ __chk_fail (void)
{
while (1)
{
+ const char *text = "*** buffer overflow detected ***\n";
+ TEMP_FAILURE_RETRY (write (STDERR_FILENO, text, strlen (text)));
/* This will leave a nice backtrace. */
abort ();
#ifdef ABORT_INSTRUCTION