X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdio%2Ffopen.c;h=e806b00a2ef76c31879a2aa0a19b55b368962aa6;hp=ff8e8e8a08862ea7679d54d3457d41531c3a7599;hb=c5d49235e09fbd58416f10dec2799e61cf3431c8;hpb=4c7c56442f6b3e08c17594dd4e8095fca3aec9cf diff --git a/functions/stdio/fopen.c b/functions/stdio/fopen.c index ff8e8e8..e806b00 100644 --- a/functions/stdio/fopen.c +++ b/functions/stdio/fopen.c @@ -24,15 +24,16 @@ FILE * fopen( const char * _PDCLIB_restrict filename, if( imode == 0 || filename == NULL ) return NULL; - _PDCLIB_fd_t fd = _PDCLIB_open( filename, imode ); - if(fd == _PDCLIB_NOHANDLE) { + _PDCLIB_fd_t fd; + const _PDCLIB_fileops_t * ops; + if(!_PDCLIB_open( &fd, &ops, filename, imode )) { return NULL; } - FILE * f = _PDCLIB_fdopen( fd, imode, filename ); + FILE * f = _PDCLIB_fvopen( fd, ops, imode, filename ); if(!f) { int saveErrno = errno; - _PDCLIB_close( fd ); + ops->close(fd); errno = saveErrno; } return f;