Avoid an access violation if malloc failes.
[glibc.git] / string / bug-strncat1.c
blobf1b5c37c5cd14b96fbb9672486700de22e0a7720
1 /* Test case by Joseph S. Myers <jsm28@cam.ac.uk>. */
2 #undef __USE_STRING_INLINES
3 #define __USE_STRING_INLINES
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
8 char d[3] = "\0\1\2";
10 int
11 main (void)
13 strncat (d, "\5\6", 1);
14 if (d[0] != '\5')
16 puts ("d[0] != '\\5'");
17 exit (1);
19 if (d[1] != '\0')
21 puts ("d[1] != '\\0'");
22 exit (1);
24 if (d[2] != '\2')
26 puts ("d[2] != '\\2'");
27 exit (1);
30 return 0;