diff --git a/ChangeLog b/ChangeLog
index 70abf712..a35164e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-03-22  Joerg Wunsch <j.gnu@uriah.heep.sax.de>
+
+	bug #25971: "error writing to <stdout>" with multiple -U params.
+	* fileio.c: Do not close the input/output stream when working on an
+	stdio stream.
+
 2009-02-28  Thomas Fischl <tfischl@gmx.de>
 
 	Based on patch #6484 commited by Jurgis Brigmanis:
diff --git a/fileio.c b/fileio.c
index 60975c02..11905fe3 100644
--- a/fileio.c
+++ b/fileio.c
@@ -1150,7 +1150,7 @@ int fileio(int op, char * filename, FILEFMT format,
       rc = avr_mem_hiaddr(mem);
     }
   }
-  if (format != FMT_IMM) {
+  if (format != FMT_IMM && !using_stdio) {
     fclose(f);
   }
   return rc;