bool was_fdopen = FALSE;
char *type = NULL;
char mode[PERL_MODE_MAX]; /* file mode ("r\0", "rb\0", "ab\0" etc.) */
- SV *namesv;
PERL_ARGS_ASSERT_DO_OPENN;
;
const int modifyingmode = O_WRONLY|O_RDWR|O_CREAT|appendtrunc;
int ismodifying;
+ SV *namesv;
if (num_svs != 0) {
Perl_croak(aTHX_ "panic: sysopen with multiple args, num_svs=%ld",
IoTYPE(io) = PerlIO_intmode2str(rawmode, &mode[ix], &writing);
namesv = newSVpvn_flags(oname, len, SVs_TEMP);
- num_svs = 1;
- svp = &namesv;
type = NULL;
- fp = PerlIO_openn(aTHX_ type, mode, -1, rawmode, rawperm, NULL, num_svs, svp);
+ fp = PerlIO_openn(aTHX_ type, mode, -1, rawmode, rawperm, NULL, 1, &namesv);
}
else {
/* Regular (non-sys) open */
}
}
else {
- if (!num_svs) {
- namesv = newSVpvn_flags(type, tend - type, SVs_TEMP);
- num_svs = 1;
- svp = &namesv;
+ if (num_svs) {
+ fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp);
+ }
+ else {
+ SV *namesv = newSVpvn_flags(type, tend - type, SVs_TEMP);
type = NULL;
+ fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,1,&namesv);
}
- fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp);
}
} /* !& */
if (!fp && type && *type && *type != ':' && !isIDFIRST(*type))
}
}
else {
- if (!num_svs) {
- namesv = newSVpvn_flags(type, tend - type, SVs_TEMP);
- num_svs = 1;
- svp = &namesv;
+ if (num_svs) {
+ fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp);
+ }
+ else {
+ SV *namesv = newSVpvn_flags(type, tend - type, SVs_TEMP);
type = NULL;
+ fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,1,&namesv);
}
- fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp);
}
if (!fp && type && *type && *type != ':' && !isIDFIRST(*type))
goto unknown_open_mode;
IoTYPE(io) = IoTYPE_STD;
}
else {
- if (!num_svs) {
- namesv = newSVpvn_flags(type, tend - type, SVs_TEMP);
- num_svs = 1;
- svp = &namesv;
+ if (num_svs) {
+ fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp);
+ }
+ else {
+ SV *namesv = newSVpvn_flags(type, tend - type, SVs_TEMP);
type = NULL;
+ fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,1,&namesv);
}
- fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp);
}
}
}