shithub: femtolisp

Download patch

ref: 8f04eea84792ec9dd3038860e66abb4206ff2a18
parent: 27b18d04d0b010a15670391ecb73698b5f5037bd
author: Jeff Bezanson <jeff.bezanson@gmail.com>
date: Thu May 22 14:09:49 EDT 2014

fix bug in file-not-found due to incomplete init of the ios_t

--- a/iostream.c
+++ b/iostream.c
@@ -28,11 +28,8 @@
 {
     ios_t *olds = value2c(ios_t*, oldv);
     ios_t *news = value2c(ios_t*, newv);
-    cvalue_t *cv = (cvalue_t*)ptr(oldv);
-    if (isinlined(cv)) {
-        if (olds->buf == &olds->local[0]) {
-            news->buf = &news->local[0];
-        }
+    if (news->buf == &olds->local[0]) {
+        news->buf = &news->local[0];
     }
 }
 
--- a/llt/ios.c
+++ b/llt/ios.c
@@ -752,9 +752,9 @@
     if (create) flags |= O_CREAT;
     if (trunc)  flags |= O_TRUNC;
     fd = open(fname, flags, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH/*644*/);
+    s = ios_fd(s, fd, 1, 1);
     if (fd == -1)
         goto open_file_err;
-    s = ios_fd(s, fd, 1, 1);
     if (!wr)
         s->readonly = 1;
     return s;