<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.24.1">
</HEAD>
<BODY>
<PRE>
---
 tools/winedump/pe.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c
index 31a744e..e6a6dff 100644
--- a/tools/winedump/pe.c
+++ b/tools/winedump/pe.c
@@ -947,6 +947,12 @@ static const char *get_resource_type( unsigned int id )
     return NULL;
 }
 
+static void report_error_and_exit (const char * s)
+{
+   perror ( s );
+   exit ( 1 );
+}
+
 /* dump an ASCII string with proper escaping */
 static int dump_strA( const unsigned char *str, size_t len )
 {
@@ -959,7 +965,8 @@ static int dump_strA( const unsigned char *str, size_t len )
     {
         if (pos &gt; buffer + sizeof(buffer) - 8)
         {
-            fwrite( buffer, pos - buffer, 1, stdout );
+            if (fwrite( buffer, pos - buffer, 1, stdout ) != 1)
+               report_error_and_exit ( &quot;Error dumping ASCII string&quot; );
             count += pos - buffer;
             pos = buffer;
         }
@@ -982,7 +989,8 @@ static int dump_strA( const unsigned char *str, size_t len )
         if (*str == '\\') *pos++ = '\\';
         *pos++ = *str;
     }
-    fwrite( buffer, pos - buffer, 1, stdout );
+    if (fwrite( buffer, pos - buffer, 1, stdout ) != 1)
+      report_error_and_exit ( &quot;Error dumping ASCII string&quot; );
     count += pos - buffer;
     return count;
 }
@@ -999,7 +1007,8 @@ static int dump_strW( const WCHAR *str, size_t len )
     {
         if (pos &gt; buffer + sizeof(buffer) - 8)
         {
-            fwrite( buffer, pos - buffer, 1, stdout );
+            if (fwrite( buffer, pos - buffer, 1, stdout ) != 1)
+               report_error_and_exit ( &quot;Error dumping Unicode string&quot; );
             count += pos - buffer;
             pos = buffer;
         }
@@ -1025,7 +1034,8 @@ static int dump_strW( const WCHAR *str, size_t len )
         if (*str == '\\') *pos++ = '\\';
         *pos++ = *str;
     }
-    fwrite( buffer, pos - buffer, 1, stdout );
+    if (fwrite( buffer, pos - buffer, 1, stdout ) != 1)
+        report_error_and_exit ( &quot;Error dumping Unicode string&quot; );
     count += pos - buffer;
     return count;
 }
-- 
1.5.6.3
</PRE>
</BODY>
</HTML>