summaryrefslogtreecommitdiff
path: root/stdio-common/bug22.c
blob: 2228388b47a7a8f4d127d4219cf3d713680b0405 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* BZ #5424 */
#include <stdio.h>

#define N 2147483648

#define STRINGIFY(S) #S
#define MAKE_STR(S) STRINGIFY(S)

#define SN MAKE_STR(N)

static int
do_test (void)
{
  int ret;

  FILE *fp = fopen ("/dev/null", "w");
  if (fp == NULL)
    {
      puts ("cannot open /dev/null");
      return 1;
    }

  ret = fprintf (fp, "%" SN "d%" SN "d", 1, 1);

  printf ("ret = %d\n", ret);

  return ret != -1;
}

#define TIMEOUT 30
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"