Hi Kacper,

very good explanation, thanks. Fixed in SVN 226.

/// Jürgen


On 04/26/2014 03:43 PM, Kacper Gutowski wrote:
On 2014-04-26 07:13:21, enz...@gmx.com wrote:
btw if you can take a look at the FILE_IO code in 
http://lists.gnu.org/archive/html/bug-apl/2014-04/msg00269.html
and give me an idea why the difference between c popen and apl popen - null vs 
no '10' at end of data still returned - i'd appreciate it
The difference is that there is a bug in lib_file_io.
When FILE_IO[8] is called dyadically, return value of fgets(3) is silently 
ignored and garbage is returned.

-k



Index: src/native/file_io.cc
===================================================================
--- src/native/file_io.cc (revision 224)
+++ src/native/file_io.cc (working copy)
@@ -796,7 +796,7 @@
                     buffer = del = new char[bytes + 1];
const char * s = fgets(buffer, bytes, fe.fe_file);
-                const int len = strlen(buffer);
+                const int len = s ? strlen(s) : 0;
                  Value_P Z(new Value(len, LOC));
                  new (&Z->get_ravel(0)) IntCell(0);   // prototype
                  loop(z, len)   new (&Z->get_ravel(z)) IntCell(buffer[z] & 
0xFF);





Reply via email to