summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorAndy Dougherty <doughera.lafayette.edu>1995-12-08 00:34:53 +0000
committerAndy Dougherty <doughera.lafayette.edu>1995-12-08 00:34:53 +0000
commit3712091946b37b5feabcc1f630b32639406ad717 (patch)
tree95688437cf1016cf9fa191b44e7c97d20eb24fd5 /toke.c
parent4e68a2086f0b5bfb6d7944f2efbad03461f54f71 (diff)
downloadperl-3712091946b37b5feabcc1f630b32639406ad717.tar.gz
This is patch.2b1f to perl5.002beta1.
cd to your perl source directory, execute the command above, and type patch -p1 -N < patch.2b1f This patch includes patches for the following items: Changes.Conf Configure MANIFEST Makefile.SH XSUB.h ext/POSIX/POSIX.pm ext/POSIX/POSIX.pod ext/POSIX/POSIX.xs ext/Socket/Socket.pm gv.c lib/Cwd.pm lib/Sys/Syslog.pm lib/diagnostics.pm t/lib/socket.t toke.c The changes are described after each /^Index/ line below. These are each described in detail below, after the corresponding index line. Patch and enjoy, Andy Dougherty doughera@lafcol.lafayette.edu Dept. of Physics Lafayette College, Easton PA 18042
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/toke.c b/toke.c
index 2cfcefb0ce..118079c3a4 100644
--- a/toke.c
+++ b/toke.c
@@ -1069,13 +1069,21 @@ filter_read(idx, buf_sv, maxlen)
/* ensure buf_sv is large enough */
SvGROW(buf_sv, old_len + maxlen) ;
- if ((len = fread(SvPVX(buf_sv) + old_len, 1, maxlen, rsfp)) <= 0)
- return len ;
+ if ((len = fread(SvPVX(buf_sv) + old_len, 1, maxlen, rsfp)) <= 0){
+ if (ferror(rsfp))
+ return -1; /* error */
+ else
+ return 0 ; /* end of file */
+ }
SvCUR_set(buf_sv, old_len + len) ;
} else {
/* Want a line */
- if (sv_gets(buf_sv, rsfp, SvCUR(buf_sv)) == NULL)
- return -1; /* end of file */
+ if (sv_gets(buf_sv, rsfp, SvCUR(buf_sv)) == NULL) {
+ if (ferror(rsfp))
+ return -1; /* error */
+ else
+ return 0 ; /* end of file */
+ }
}
return SvCUR(buf_sv);
}
@@ -1092,7 +1100,7 @@ filter_read(idx, buf_sv, maxlen)
idx, funcp, SvPV(datasv,na));
/* Call function. The function is expected to */
/* call "FILTER_READ(idx+1, buf_sv)" first. */
- /* Return: <0:error/eof, >=0:not eof (see yylex()) */
+ /* Return: <0:error, =0:eof, >0:not eof */
return (*funcp)(idx, buf_sv, maxlen);
}