]>
Commit | Line | Data |
---|---|---|
02fb3d17 | 1 | #undef __USE_STRING_INLINES |
9c3b1ceb | 2 | #define __USE_STRING_INLINES |
85ac7edc AZN |
3 | #include <sys/cdefs.h> |
4 | #include <libc-diag.h> | |
5 | #if __GNUC_PREREQ (8, 0) | |
6 | /* GCC warns about strncat truncating output; this is deliberately | |
7 | tested here. If fortify is enabled, it is also triggered by the | |
8 | wrappers. */ | |
9 | DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-truncation"); | |
10 | #endif | |
9c3b1ceb UD |
11 | #include <stdio.h> |
12 | #include <stdlib.h> | |
13 | #include <string.h> | |
14 | ||
15 | char d[3] = "\0\1\2"; | |
16 | ||
17 | int | |
18 | main (void) | |
19 | { | |
ec72135e | 20 | DIAG_PUSH_NEEDS_COMMENT; |
9c3b1ceb | 21 | strncat (d, "\5\6", 1); |
ec72135e | 22 | DIAG_POP_NEEDS_COMMENT; |
9c3b1ceb UD |
23 | if (d[0] != '\5') |
24 | { | |
25 | puts ("d[0] != '\\5'"); | |
26 | exit (1); | |
27 | } | |
28 | if (d[1] != '\0') | |
29 | { | |
30 | puts ("d[1] != '\\0'"); | |
31 | exit (1); | |
32 | } | |
33 | if (d[2] != '\2') | |
34 | { | |
0696fe75 | 35 | puts ("d[2] != '\\2'"); |
9c3b1ceb UD |
36 | exit (1); |
37 | } | |
38 | ||
bf4de8f3 | 39 | return 0; |
9c3b1ceb | 40 | } |