]> git.ipfire.org Git - thirdparty/glibc.git/blame - stdio-common/bug22.c
vfprintf: Define WORK_BUFFER_SIZE
[thirdparty/glibc.git] / stdio-common / bug22.c
CommitLineData
b4354cf4
UD
1/* BZ #5424 */
2#include <stdio.h>
135ffda8 3#include <errno.h>
b4354cf4 4
135ffda8 5/* INT_MAX + 1 */
b4354cf4
UD
6#define N 2147483648
7
135ffda8
DM
8/* (INT_MAX / 2) + 2 */
9#define N2 1073741825
10
11/* INT_MAX - 3 */
12#define N3 2147483644
13
b4354cf4
UD
14#define STRINGIFY(S) #S
15#define MAKE_STR(S) STRINGIFY(S)
16
17#define SN MAKE_STR(N)
135ffda8
DM
18#define SN2 MAKE_STR(N2)
19#define SN3 MAKE_STR(N3)
b4354cf4
UD
20
21static int
22do_test (void)
23{
24 int ret;
25
26 FILE *fp = fopen ("/dev/null", "w");
27 if (fp == NULL)
28 {
29 puts ("cannot open /dev/null");
30 return 1;
31 }
32
135ffda8
DM
33 ret = fprintf (fp, "%" SN "d", 1);
34 printf ("ret = %d\n", ret);
35 if (ret != -1 || errno != EOVERFLOW)
36 return 1;
37
38 ret = fprintf (fp, "%." SN "d", 1);
39 printf ("ret = %d\n", ret);
40 if (ret != -1 || errno != EOVERFLOW)
41 return 1;
42
43 ret = fprintf (fp, "%." SN3 "d", 1);
44 printf ("ret = %d\n", ret);
45 if (ret != -1 || errno != EOVERFLOW)
46 return 1;
b4354cf4 47
135ffda8 48 ret = fprintf (fp, "%" SN2 "d%" SN2 "d", 1, 1);
b4354cf4
UD
49 printf ("ret = %d\n", ret);
50
135ffda8 51 return ret != -1 || errno != EOVERFLOW;
b4354cf4
UD
52}
53
286abc3d 54#define TIMEOUT 60
b4354cf4
UD
55#define TEST_FUNCTION do_test ()
56#include "../test-skeleton.c"