From 594e7e955cfd923c9602840439c5749d046f6973 Mon Sep 17 00:00:00 2001
From: Joerg Wunsch <j@uriah.heep.sax.de>
Date: Sun, 22 Mar 2009 21:28:46 +0000
Subject: [PATCH] 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.

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@816 81a1dc3b-b13d-400b-aceb-764788c761c2
---
 ChangeLog | 6 ++++++
 fileio.c  | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

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;