summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorTim Bunce <Tim.Bunce@pobox.com>1997-10-15 15:55:26 +0000
committerTim Bunce <Tim.Bunce@pobox.com>1997-10-15 15:55:26 +0000
commit50e27ac33704d6fb34d4be7cfb426b2097b27505 (patch)
tree0b92fcafbf7277d6096b994621b87c50f7988ff8 /pp_sys.c
parent2269e8ecc334a5a77bdb915666547431c0171402 (diff)
parentfb73857aa0bfa8ed43d4d2f972c564c70a57e0c4 (diff)
downloadperl-50e27ac33704d6fb34d4be7cfb426b2097b27505.tar.gz
Maintenance 5.004_04 changes
p4raw-id: //depot/maint-5.004/perl@128
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/pp_sys.c b/pp_sys.c
index d0915e0327..d574b2e852 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1369,7 +1369,7 @@ PP(pp_send)
if (-offset > blen)
DIE("Offset outside string");
offset += blen;
- } else if (offset >= blen)
+ } else if (offset >= blen && blen > 0)
DIE("Offset outside string");
} else
offset = 0;
@@ -2402,16 +2402,20 @@ PP(pp_fttty)
dSP;
int fd;
GV *gv;
- char *tmps;
- if (op->op_flags & OPf_REF) {
+ char *tmps = Nullch;
+
+ if (op->op_flags & OPf_REF)
gv = cGVOP->op_gv;
- tmps = "";
- }
+ else if (isGV(TOPs))
+ gv = (GV*)POPs;
+ else if (SvROK(TOPs) && isGV(SvRV(TOPs)))
+ gv = (GV*)SvRV(POPs);
else
gv = gv_fetchpv(tmps = POPp, FALSE, SVt_PVIO);
+
if (GvIO(gv) && IoIFP(GvIOp(gv)))
fd = PerlIO_fileno(IoIFP(GvIOp(gv)));
- else if (isDIGIT(*tmps))
+ else if (tmps && isDIGIT(*tmps))
fd = atoi(tmps);
else
RETPUSHUNDEF;
@@ -2705,6 +2709,9 @@ PP(pp_readlink)
char buf[MAXPATHLEN];
int len;
+#ifndef INCOMPLETE_TAINTS
+ TAINT;
+#endif
tmps = POPp;
len = readlink(tmps, buf, sizeof buf);
EXTEND(SP, 1);
@@ -2881,6 +2888,7 @@ PP(pp_readdir)
register Direntry_t *dp;
GV *gv = (GV*)POPs;
register IO *io = GvIOn(gv);
+ SV *sv;
if (!io || !IoDIRP(io))
goto nope;
@@ -2889,20 +2897,28 @@ PP(pp_readdir)
/*SUPPRESS 560*/
while (dp = (Direntry_t *)readdir(IoDIRP(io))) {
#ifdef DIRNAMLEN
- XPUSHs(sv_2mortal(newSVpv(dp->d_name, dp->d_namlen)));
+ sv = newSVpv(dp->d_name, dp->d_namlen);
#else
- XPUSHs(sv_2mortal(newSVpv(dp->d_name, 0)));
+ sv = newSVpv(dp->d_name, 0);
+#endif
+#ifndef INCOMPLETE_TAINTS
+ SvTAINTED_on(sv);
#endif
+ XPUSHs(sv_2mortal(sv));
}
}
else {
if (!(dp = (Direntry_t *)readdir(IoDIRP(io))))
goto nope;
#ifdef DIRNAMLEN
- XPUSHs(sv_2mortal(newSVpv(dp->d_name, dp->d_namlen)));
+ sv = newSVpv(dp->d_name, dp->d_namlen);
#else
- XPUSHs(sv_2mortal(newSVpv(dp->d_name, 0)));
+ sv = newSVpv(dp->d_name, 0);
#endif
+#ifndef INCOMPLETE_TAINTS
+ SvTAINTED_on(sv);
+#endif
+ XPUSHs(sv_2mortal(sv));
}
RETURN;
@@ -4063,6 +4079,9 @@ PP(pp_gpwent)
#endif
PUSHs(sv = sv_mortalcopy(&sv_no));
sv_setpv(sv, pwent->pw_gecos);
+#ifndef INCOMPLETE_TAINTS
+ SvTAINTED_on(sv);
+#endif
PUSHs(sv = sv_mortalcopy(&sv_no));
sv_setpv(sv, pwent->pw_dir);
PUSHs(sv = sv_mortalcopy(&sv_no));