summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2002-06-17 12:41:49 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2002-06-17 12:41:49 +0000
commitaca0daca701f7dcdb767d1bc406a8942960007bc (patch)
tree4aa968c11efe83460b077cf2bfcd3ed5cfb8e2b4 /sv.c
parent4548d6fb02b29821283f89a8b1d5c3c9a6e3c2a3 (diff)
downloadperl-aca0daca701f7dcdb767d1bc406a8942960007bc.tar.gz
Handle IO error in "slow gets"
p4raw-id: //depot/perlio@17267
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sv.c b/sv.c
index f3d39ce722..1c1932ac42 100644
--- a/sv.c
+++ b/sv.c
@@ -3194,7 +3194,7 @@ Perl_sv_copypv(pTHX_ SV *dsv, register SV *ssv)
{
SV *tmpsv;
- if ( SvTHINKFIRST(ssv) && SvROK(ssv) && SvAMAGIC(ssv) &&
+ if ( SvTHINKFIRST(ssv) && SvROK(ssv) && SvAMAGIC(ssv) &&
(tmpsv = AMG_CALLun(ssv,string))) {
if (SvTYPE(tmpsv) != SVt_RV || (SvRV(tmpsv) != SvRV(ssv))) {
SvSetSV(dsv,tmpsv);
@@ -5882,13 +5882,15 @@ screamer2:
/* Accomodate broken VAXC compiler, which applies U8 cast to
* both args of ?: operator, causing EOF to change into 255
*/
- if (cnt) { i = (U8)buf[cnt - 1]; } else { i = EOF; }
+ if (cnt > 0) { i = (U8)buf[cnt - 1]; } else { i = EOF; }
}
- if (append)
- sv_catpvn(sv, (char *) buf, cnt);
- else
- sv_setpvn(sv, (char *) buf, cnt);
+ if (cnt > 0) {
+ if (append)
+ sv_catpvn(sv, (char *) buf, cnt);
+ else
+ sv_setpvn(sv, (char *) buf, cnt);
+ }
if (i != EOF && /* joy */
(!rslen ||