nonstring: Enable __FORTIFY_LEVEL=3
[glibc.git] / elf / tst-audit15.c
blobcbd1589ec40653d16ee947060a927c6f95700a55
1 /* Main program with DT_AUDIT and DT_DEPAUDIT. Two audit modules.
2 Copyright (C) 2020 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <stdlib.h>
20 #include <string.h>
21 #include <support/check.h>
22 #include <support/xstdio.h>
24 static int
25 do_test (void)
27 /* Verify what the audit modules have written. This test assumes
28 that standard output has been redirected to a regular file. */
29 FILE *fp = xfopen ("/dev/stdout", "r");
31 char *buffer = NULL;
32 size_t buffer_length = 0;
33 size_t line_length = xgetline (&buffer, &buffer_length, fp);
34 const char *message = "info: tst-auditlogmod-1.so loaded\n";
35 TEST_COMPARE_BLOB (message, strlen (message), buffer, line_length);
37 line_length = xgetline (&buffer, &buffer_length, fp);
38 message = "info: tst-auditlogmod-2.so loaded\n";
39 TEST_COMPARE_BLOB (message, strlen (message), buffer, line_length);
41 /* No more audit module output. */
42 line_length = xgetline (&buffer, &buffer_length, fp);
43 TEST_COMPARE_BLOB ("", 0, buffer, line_length);
45 free (buffer);
46 xfclose (fp);
47 return 0;
50 #include <support/test-driver.c>