Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Update.
2002-08-26 Ulrich Drepper <drepper@redhat.com> * libio/Makefile (tests): Add bug-fopena+. * libio/bug-fopena+.c: New file. * stdio-common/tst-swprintf.c (main): Add casts to avoid warnings. * locale/xlocale.c: Fix the last change. The variable still has to end in _data. * sysdeps/generic/bits/libc-tsd.h [!(USE_TLS && HAVE___THREAD)] (__libc_tsd_set): Add _data prefix to variable name.
- Loading branch information
Ulrich Drepper
committed
Aug 27, 2002
1 parent
3832592
commit b50f387
Showing
7 changed files
with
130 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters