/* Test and measure __strcpy_chk functions.
- Copyright (C) 1999-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#ifndef STRCPY_RESULT
# define STRCPY_RESULT(dst, len) dst
#include <setjmp.h>
#include <signal.h>
+static int test_main (void);
+#define TEST_FUNCTION test_main
+#include <support/test-driver.c>
+#include <support/support.h>
+
volatile int chk_fail_ok;
jmp_buf chk_fail_buf;
}
}
-int
+static int
test_main (void)
{
size_t i;
- struct sigaction sa;
- sa.sa_handler = handler;
- sa.sa_flags = 0;
- sigemptyset (&sa.sa_mask);
-
- 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);
+ set_fortify_handler (handler);
test_init ();
do_random_tests ();
return ret;
}
-
-#include "../test-skeleton.c"