Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
pdate.
	* libio/tst-eof.c: Rewrite to let test-skeleton.c deal with
	creation and removal of the temp file.
  • Loading branch information
Ulrich Drepper committed Jul 23, 2002
1 parent 3fa3d0b commit 97887d3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
@@ -1,5 +1,8 @@
2002-07-22 Ulrich Drepper <drepper@redhat.com>

* libio/tst-eof.c: Rewrite to let test-skeleton.c deal with
creation and removal of the temp file.

* libio/bug-rewind.c: Use test skeleton. Use create_temp_file for
file creation.
* test-skeleton.c (create_temp_file): New function.
Expand Down
34 changes: 16 additions & 18 deletions libio/tst-eof.c
Expand Up @@ -4,35 +4,33 @@
#include <unistd.h>


static void do_prepare (void);
#define PREPARE(argc, argv) do_prepare ()
static int do_test (void);
#define TEST_FUNCTION do_test ()
#include <test-skeleton.c>


static int
do_test (void)
{
char *buf;
int fd;
FILE *fp;
int fd;

buf = (char *) malloc (strlen (test_dir) + sizeof "/tst-eof.XXXXXX");
if (buf == NULL)
{
printf ("cannot allocate memory: %m\n");
return 1;
}
stpcpy (stpcpy (buf, test_dir), "/tst-eof.XXXXXX");

fd = mkstemp (buf);
static void
do_prepare (void)
{
fd = create_temp_file ("tst-eof.", NULL);
if (fd == -1)
{
printf ("cannot open temporary file: %m\n");
return 1;
printf ("cannot create temporary file: %m\n");
exit (1);
}
}

/* Make sure it gets removed. */
add_temp_file (buf);

static int
do_test (void)
{
char buf[40];
FILE *fp;

if (write (fd, "some string\n", 12) != 12)
{
Expand Down

0 comments on commit 97887d3

Please sign in to comment.