# New Ticket Created by  Lars Balker Rasmussen 
# Please include the string:  [perl #24802]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=24802 >


Following the file reading bug in chartype.c, I checked the rest of
parrot for fopen's, to see if there were similar errors.

A minor similar one was found in src/debug.c.
-- 
Lars Balker Rasmussen                                      Consult::Perl

Index: src/debug.c
===================================================================
RCS file: /cvs/public/parrot/src/debug.c,v
retrieving revision 1.116
diff -u -a -r1.116 debug.c
--- src/debug.c	13 Dec 2003 15:01:17 -0000	1.116
+++ src/debug.c	3 Jan 2004 22:06:11 -0000
@@ -1533,8 +1533,8 @@
 PDB_load_source(struct Parrot_Interp *interpreter, const char *command)
 {
     FILE *file;
-    char f[255], c;
-    int i;
+    char f[255];
+    int i, c;
     unsigned long size = 0;
     PDB_t *pdb = interpreter->pdb;
     PDB_file_t *pfile;
@@ -1566,15 +1566,14 @@
     pfile->line = pline;
     pline->number = 1;
 
-    while (!feof(file)) {
-        c = (char)fgetc(file);
+    while ((c = fgetc(file)) != EOF) {
         /* Grow it */
         if (++size == 1024) {
             pfile->source = mem_sys_realloc(pfile->source,
                                             (size_t)pfile->size + 1024);
             size = 0;
         }
-        pfile->source[pfile->size] = c;
+        pfile->source[pfile->size] = (char)c;
 
         pfile->size++;
 

Reply via email to