stas 2002/08/21 08:41:29
Modified: xs/APR/PerlIO apr_perlio.c
Log:
similar to the perlio case:
- IoIFP(io) *must* be always set on the valid io sv, otherwise it'll be
never closed and fh and memory leaked. as i saw from doio.c, the solution
is to simply copy IoOFP.
- add IoTYPE_WRONLY and IoTYPE_RDONLY flags to protect from wrong use
Revision Changes Path
1.24 +4 -1 modperl-2.0/xs/APR/PerlIO/apr_perlio.c
Index: apr_perlio.c
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/APR/PerlIO/apr_perlio.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- apr_perlio.c 21 Aug 2002 15:40:17 -0000 1.23
+++ apr_perlio.c 21 Aug 2002 15:41:29 -0000 1.24
@@ -567,11 +567,14 @@
switch (type) {
case APR_PERLIO_HOOK_WRITE:
- IoOFP(GvIOp(gv)) = apr_perlio_apr_file_to_FILE(aTHX_ file, type);
+ IoIFP(GvIOp(gv)) = IoOFP(GvIOp(gv)) =
+ apr_perlio_apr_file_to_FILE(aTHX_ file, type);
IoFLAGS(GvIOp(gv)) |= IOf_FLUSH;
+ IoTYPE(GvIOp(gv)) = IoTYPE_WRONLY;
break;
case APR_PERLIO_HOOK_READ:
IoIFP(GvIOp(gv)) = apr_perlio_apr_file_to_FILE(aTHX_ file, type);
+ IoTYPE(GvIOp(gv)) = IoTYPE_RDONLY;
break;
};