diff options
Diffstat (limited to 'stdio-common')
-rw-r--r-- | stdio-common/Makefile | 6 | ||||
-rw-r--r-- | stdio-common/bug3.c | 4 | ||||
-rw-r--r-- | stdio-common/bug4.c | 4 | ||||
-rw-r--r-- | stdio-common/bug5.c | 13 | ||||
-rw-r--r-- | stdio-common/scanf7.c | 2 | ||||
-rw-r--r-- | stdio-common/test-popen.c | 6 |
6 files changed, 24 insertions, 11 deletions
diff --git a/stdio-common/Makefile b/stdio-common/Makefile index 8c7bae9c45..e65ff70713 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -50,3 +50,9 @@ include ../Rules CFLAGS-_itoa.c = -Wno-unused CFLAGS-tst-printf.c = -Wno-format + +ifeq ($(stdio),libio) +ifneq (,$(filter %REENTRANT, $(defines))) +CPPFLAGS += -D_IO_MTSAFE_IO +endif +endif diff --git a/stdio-common/bug3.c b/stdio-common/bug3.c index 1684720b9f..3bb0158a21 100644 --- a/stdio-common/bug3.c +++ b/stdio-common/bug3.c @@ -7,8 +7,9 @@ DEFUN_VOID(main) { FILE *f; int i; + const char filename[] = "/tmp/bugtest"; - f = fopen("/tmp/bugtest", "w+"); + f = fopen(filename, "w+"); for (i=0; i<9000; i++) putc ('x', f); fseek (f, 8180L, 0); @@ -45,6 +46,7 @@ DEFUN_VOID(main) } fclose(f); + remove(filename); puts ("Test succeeded."); diff --git a/stdio-common/bug4.c b/stdio-common/bug4.c index 00abf3c502..acf5b5433b 100644 --- a/stdio-common/bug4.c +++ b/stdio-common/bug4.c @@ -14,6 +14,7 @@ DEFUN(main, (argc, argv), FILE *f; int i; char buffer[31]; + const char filename[] = "/tmp/bugtest"; while ((i = getopt (argc, argv, "rw")) != EOF) switch (i) @@ -26,7 +27,7 @@ DEFUN(main, (argc, argv), break; } - f = fopen("/tmp/bugtest", "w+"); + f = fopen(filename, "w+"); for (i=0; i<9000; i++) { putc('x', f); } @@ -36,6 +37,7 @@ DEFUN(main, (argc, argv), fread(buffer, 1, 31, f); fwrite(buffer, 1, 31, stdout); fclose(f); + remove(filename); if (!memcmp (buffer, "Where does this text come from?", 31)) { diff --git a/stdio-common/bug5.c b/stdio-common/bug5.c index 18f069ae29..def73397de 100644 --- a/stdio-common/bug5.c +++ b/stdio-common/bug5.c @@ -17,7 +17,8 @@ DEFUN_VOID(main) FILE *out; static char inname[] = "/tmp/bug5.in"; static char outname[] = "/tmp/bug5.out"; - int i; + char *printbuf; + int i, result; /* Create a test file. */ in = fopen (inname, "w+"); @@ -54,7 +55,11 @@ DEFUN_VOID(main) puts ("There should be no further output from this test."); fflush (stdout); - execlp ("cmp", "cmp", inname, outname, (char *) NULL); - perror ("execlp: cmp"); - exit (1); + + asprintf (&printbuf, "cmp %s %s", inname, outname); + result = system (printbuf); + remove (inname); + remove (outname); + + exit ((result != 0)); } diff --git a/stdio-common/scanf7.c b/stdio-common/scanf7.c index 386dac4d06..d5023af8a1 100644 --- a/stdio-common/scanf7.c +++ b/stdio-common/scanf7.c @@ -8,7 +8,7 @@ main () n = -1; ret = sscanf ("1000", "%lld", &n); - printf ("%%lld: ret: %d, n: %Ld, c: %c\n", ret, n); + printf ("%%lld: ret: %d, n: %Ld\n", ret, n); if (ret != 1 || n != 1000L) abort (); diff --git a/stdio-common/test-popen.c b/stdio-common/test-popen.c index b452f3f63c..a17606e503 100644 --- a/stdio-common/test-popen.c +++ b/stdio-common/test-popen.c @@ -58,10 +58,8 @@ DEFUN_VOID(main) rstatus = pclose (input); printf ("reading pclose returned %d\n", rstatus); + remove ("/tmp/tstpopen.tmp"); + puts (wstatus | rstatus ? "Test FAILED!" : "Test succeeded."); exit (wstatus | rstatus); } - - - - |