aboutsummaryrefslogtreecommitdiff
path: root/libio/bug-fopena+.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
committerZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
commit5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch)
tree4470480d904b65cf14ca524f96f79eca818c3eaf /libio/bug-fopena+.c
parent199fc19d3aaaf57944ef036e15904febe877fc93 (diff)
downloadglibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar
glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.gz
glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.bz2
glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.zip
Prepare for radical source tree reorganization.zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage directory, REORG.TODO, except for files that will certainly still exist in their current form at top level when we're done (COPYING, COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which are moved to the new directory OldChangeLogs, instead), and the generated file INSTALL (which is just deleted; in the new order, there will be no generated files checked into version control).
Diffstat (limited to 'libio/bug-fopena+.c')
-rw-r--r--libio/bug-fopena+.c100
1 files changed, 0 insertions, 100 deletions
diff --git a/libio/bug-fopena+.c b/libio/bug-fopena+.c
deleted file mode 100644
index 5446de1592..0000000000
--- a/libio/bug-fopena+.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-static int fd;
-static char *fname;
-
-
-static void prepare (void);
-#define PREPARE(argc, argv) prepare ()
-
-
-#define TEST_FUNCTION do_test ()
-static int do_test (void);
-#include "../test-skeleton.c"
-
-
-static void
-prepare (void)
-{
- fd = create_temp_file ("wrewind.", &fname);
- if (fd == -1)
- exit (3);
-}
-
-
-static int
-do_test (void)
-{
- char buf[100];
- FILE *fp;
- int result = 0;
-
- fp = fdopen (fd, "w");
- if (fp == NULL)
- {
- puts ("cannot create file");
- exit (1);
- }
-
- if (fputs ("one\n", fp) == EOF || fputs ("two\n", fp) == EOF)
- {
- puts ("cannot create filec content");
- exit (1);
- }
-
- fclose (fp);
-
- fp = fopen (fname, "a+");
- if (fp == NULL)
- {
- puts ("cannot fopen a+");
- exit (1);
- }
-
- if (fgets (buf, sizeof (buf), fp) == NULL)
- {
- puts ("cannot read after fopen a+");
- exit (1);
- }
-
- if (strcmp (buf, "one\n") != 0)
- {
- puts ("read after fopen a+ produced wrong result");
- result = 1;
- }
-
- fclose (fp);
-
- fd = open (fname, O_RDWR);
- if (fd == -1)
- {
- puts ("open failed");
- exit (1);
- }
-
- fp = fdopen (fd, "a+");
- if (fp == NULL)
- {
- puts ("fopen after open failed");
- exit (1);
- }
-
- if (fgets (buf, sizeof (buf), fp) == NULL)
- {
- puts ("cannot read after fdopen a+");
- exit (1);
- }
-
- if (strcmp (buf, "one\n") != 0)
- {
- puts ("read after fdopen a+ produced wrong result");
- result = 1;
- }
-
- fclose (fp);
-
- return result;
-}