Reverted back to an older version of freopen.c (1.15 from sources.redhat.com,

which doesn't use fd_to_filename() yet) and added it to the build.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10271 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-11-27 13:14:19 +00:00
parent 8e3485c460
commit ffc023930d
2 changed files with 35 additions and 2 deletions

View File

@ -25,7 +25,7 @@ KernelMergeObject posix_gnu_libio.o :
<$(SOURCE_GRIST)>flockfile.c
<$(SOURCE_GRIST)>fputc.c
<$(SOURCE_GRIST)>fputc_u.c
# <$(SOURCE_GRIST)>freopen.c
<$(SOURCE_GRIST)>freopen.c
<$(SOURCE_GRIST)>fseek.c
<$(SOURCE_GRIST)>fseeko.c
<$(SOURCE_GRIST)>ftello.c

View File

@ -27,9 +27,41 @@
#include "libioP.h"
#include "stdio.h"
#include <stdlib.h>
#include <shlib-compat.h>
FILE*
freopen (filename, mode, fp)
const char* filename;
const char* mode;
FILE* fp;
{
FILE *result;
CHECK_FILE (fp, NULL);
if (!(fp->_flags & _IO_IS_FILEBUF))
return NULL;
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
if (&_IO_stdin_used == NULL)
/* If the shared C library is used by the application binary which
was linked against the older version of libio, we just use the
older one even for internal use to avoid trouble since a pointer
to the old libio may be passed into shared C library and wind
up here. */
result = _IO_old_freopen (filename, mode, fp);
else
#endif
result = _IO_freopen (filename, mode, fp);
if (result != NULL)
/* unbound stream orientation */
result->_mode = 0;
_IO_funlockfile (fp);
_IO_cleanup_region_end (0);
return result;
}
#if 0
#include <fd_to_filename.h>
FILE*
@ -87,3 +119,4 @@ freopen (filename, mode, fp)
_IO_cleanup_region_end (0);
return result;
}
#endif