File pbzip2-fix_unused_result.patch of Package pbzip2

--- pbzip2.cpp.orig	2010-12-20 19:34:24.000000000 +0100
+++ pbzip2.cpp	2010-12-20 19:44:06.000000000 +0100
@@ -1802,7 +1802,17 @@
 							return ret;
 						}
 						if (nread > 0)
-							(void) fwrite (obuf, sizeof(unsigned char), nread, stream);
+                        {
+							if (fwrite (obuf, sizeof(unsigned char), nread, stream) < nread)
+                            {
+                                fprintf(stderr, "pbzip2: *ERROR: Failed to write to output file %s. Aborting!\n", OutFilename);
+                                if (zStream != stdin)
+                                    fclose(zStream);
+                                if (stream != stdout)
+                                    fclose(stream);
+                                return -1;
+                            }
+                        }
 						if (ferror(stream))
 						{
 							ret = testBZ2ErrorHandling(bzerr, bzf, streamNo);
@@ -1817,7 +1827,17 @@
 				}
 			}
 			if ((bzerr == BZ_OK || bzerr == BZ_STREAM_END) && nread > 0)
-				(void) fwrite(obuf, sizeof(unsigned char), nread, stream );
+            {
+				if (fwrite(obuf, sizeof(unsigned char), nread, stream ) < nread)
+                {
+                    fprintf(stderr, "pbzip2: *ERROR: Failed to write to output file %s. Aborting!\n", OutFilename);
+                    if (zStream != stdin)
+                        fclose(zStream);
+                    if (stream != stdout)
+                        fclose(stream);
+                    return -1;
+                }
+            }
 			if (ferror(stream))
 			{
 				ret = testBZ2ErrorHandling(bzerr, bzf, streamNo);
openSUSE Build Service is sponsored by