summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAlexander Borisov <alexander.borisov@nginx.com>2018-02-08 16:28:52 +0300
committerAlexander Borisov <alexander.borisov@nginx.com>2018-02-08 16:28:52 +0300
commit433eadc2e992c61f8c3be213ed3a5492ce341081 (patch)
treebb758019b8d021d84f5e9a3b4191ea2dda21c71a /src
parent31f72401d9356dc4413a8bac6ed059978dda7d9e (diff)
downloadunit-433eadc2e992c61f8c3be213ed3a5492ce341081.tar.gz
unit-433eadc2e992c61f8c3be213ed3a5492ce341081.tar.bz2
Perl: fixed IO-Object duplication bug.
Diffstat (limited to 'src')
-rw-r--r--src/perl/nxt_perl_psgi_layer.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/src/perl/nxt_perl_psgi_layer.c b/src/perl/nxt_perl_psgi_layer.c
index c4d50e48..f77453e9 100644
--- a/src/perl/nxt_perl_psgi_layer.c
+++ b/src/perl/nxt_perl_psgi_layer.c
@@ -259,25 +259,16 @@ nxt_perl_psgi_layer_stream_arg(pTHX_ PerlIO * f,
CLONE_PARAMS *param, int flags)
{
SV *var;
- nxt_perl_psgi_io_arg_t *arg;
nxt_perl_psgi_layer_stream_t *unit_stream;
unit_stream = PerlIOSelf(f, nxt_perl_psgi_layer_stream_t);
-
- arg = (nxt_perl_psgi_io_arg_t *) (intptr_t) SvIV(SvRV(unit_stream->var));
var = unit_stream->var;
if (flags & PERLIO_DUP_CLONE) {
var = PerlIO_sv_dup(aTHX_ var, param);
} else if (flags & PERLIO_DUP_FD) {
- var = newSV_type(SVt_RV);
-
- if (var == NULL) {
- return NULL;
- }
-
- sv_setptrref(var, arg);
+ var = newSVsv(var);
} else {
var = SvREFCNT_inc(var);
@@ -291,27 +282,12 @@ static PerlIO *
nxt_perl_psgi_layer_stream_dup(pTHX_ PerlIO *f, PerlIO *o,
CLONE_PARAMS *param, int flags)
{
- SV *var;
- nxt_perl_psgi_layer_stream_t *os, *fs;
+ nxt_perl_psgi_layer_stream_t *fs;
- os = PerlIOSelf(o, nxt_perl_psgi_layer_stream_t);
- fs = NULL;
- var = os->var;
-
- os->var = newSV_type(SVt_RV);
f = PerlIOBase_dup(aTHX_ f, o, param, flags);
if (f != NULL) {
fs = PerlIOSelf(f, nxt_perl_psgi_layer_stream_t);
-
- /* The "var" has been set by an implicit push and must be replaced. */
- SvREFCNT_dec(fs->var);
- }
-
- SvREFCNT_dec(os->var);
- os->var = var;
-
- if (f != NULL) {
fs->var = nxt_perl_psgi_layer_stream_arg(aTHX_ o, param, flags);
}