1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #include <shlib-compat.h>
- #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
- #define _IO_USE_OLD_IO_FILE
- #include "libioP.h"
- #include <stdlib.h>
- FILE *
- attribute_compat_text_section
- _IO_old_fopen (const char *filename, const char *mode)
- {
- struct locked_FILE
- {
- struct _IO_FILE_complete_plus fp;
- #ifdef _IO_MTSAFE_IO
- _IO_lock_t lock;
- #endif
- } *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
- if (new_f == NULL)
- return NULL;
- #ifdef _IO_MTSAFE_IO
- new_f->fp.file._file._lock = &new_f->lock;
- #endif
- _IO_old_init (&new_f->fp.file._file, 0);
- _IO_JUMPS_FILE_plus (&new_f->fp) = &_IO_old_file_jumps;
- _IO_old_file_init_internal ((struct _IO_FILE_plus *) &new_f->fp);
- if (_IO_old_file_fopen ((FILE *) &new_f->fp, filename, mode) != NULL)
- return (FILE *) &new_f->fp;
- _IO_un_link ((struct _IO_FILE_plus *) &new_f->fp);
- free (new_f);
- return NULL;
- }
- strong_alias (_IO_old_fopen, __old_fopen)
- compat_symbol (libc, _IO_old_fopen, _IO_fopen, GLIBC_2_0);
- compat_symbol (libc, __old_fopen, fopen, GLIBC_2_0);
- #endif
|