diff src/lstream.c @ 219:262b8bb4a523 r20-4b8

Import from CVS: tag r20-4b8
author cvs
date Mon, 13 Aug 2007 10:09:35 +0200
parents e45d5e7c476e
children f955c73f5258
line wrap: on
line diff
--- a/src/lstream.c	Mon Aug 13 10:08:36 2007 +0200
+++ b/src/lstream.c	Mon Aug 13 10:09:35 2007 +0200
@@ -186,7 +186,16 @@
     }
 #endif
   if (lstr->flags & LSTREAM_FL_IS_OPEN)
-    Lstream_close (lstr);
+    {
+      if (for_disksave)
+	{
+	  if (lstr->flags & LSTREAM_FL_CLOSE_AT_DISKSAVE)
+	    Lstream_close (lstr);
+	}
+      else
+	/* Just close. */
+	Lstream_close (lstr);
+    }
 }
 
 static unsigned int
@@ -825,6 +834,7 @@
   struct stdio_stream *str = STDIO_STREAM_DATA (lstr);
   str->file = stream;
   str->closing = flags & LSTR_CLOSING;
+  lstr->flags |= LSTREAM_FL_CLOSE_AT_DISKSAVE;
   XSETLSTREAM (obj, lstr);
   return obj;
 }
@@ -956,6 +966,7 @@
     fstr->end_pos = -1;
   else
     fstr->end_pos = fstr->starting_pos + count;
+  lstr->flags |= LSTREAM_FL_CLOSE_AT_DISKSAVE;
   XSETLSTREAM (obj, lstr);
   return obj;
 }