tunables: Use direct syscall for access (BZ#21744)
[glibc.git] / stdio-common / scanf4.c
blob7a2abec89b692405dccc301497557a8ab7bc9f7c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <libc-diag.h>
5 int
6 main(int arc, char *argv[])
8 int res;
9 unsigned int val;
11 FILE *fp = fopen ("/dev/null", "r");
13 val = 0;
14 res = fscanf(fp, "%n", &val);
16 printf("Result of fscanf %%n = %d\n", res);
17 printf("Scanned format = %d\n", val);
19 /* We're testing exactly the case the warning is for. */
20 DIAG_PUSH_NEEDS_COMMENT;
21 DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat-zero-length");
23 res = fscanf(fp, "");
25 DIAG_POP_NEEDS_COMMENT;
27 printf("Result of fscanf \"\" = %d\n", res);
28 if (res != 0)
29 abort ();
31 res = fscanf(fp, "BLURB");
32 printf("Result of fscanf \"BLURB\" = %d\n", res);
33 if (res >= 0)
34 abort ();
36 fclose (fp);
38 return 0;
39 return 0;