[Mono-list] [PATCH] BufferedStream.Write()

Francisco Figueiredo Jr. fxjrlists@yahoo.com.br
Wed, 24 Sep 2003 23:10:25 -0300


This is a multi-part message in MIME format.
--------------080709030409050206040301
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit



Hi all.
I think I found a little bug in the BufferedStream.Write() method.

It was checking for the Read permission while I think it should check 
for the *Write* permission.

I didn't do a testcase, I tested with my own program which was using the 
Write method. But I can do one if necessary. I'm looking right now in 
the BufferedStreamTest NUnit file to add a test case.


The patch is attached. It is simple, just change the check.


-- 
Regards,

Francisco Figueiredo Jr.

------
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi

--------------080709030409050206040301
Content-Type: text/plain;
 name="MonoBufferedStreamPatch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="MonoBufferedStreamPatch"

Index: BufferedStream.cs
===================================================================
RCS file: /mono/mcs/class/corlib/System.IO/BufferedStream.cs,v
retrieving revision 1.8
diff -u -r1.8 BufferedStream.cs
--- BufferedStream.cs	11 Sep 2003 23:44:33 -0000	1.8
+++ BufferedStream.cs	25 Sep 2003 01:54:45 -0000
@@ -180,7 +180,7 @@
 
 			CheckObjectDisposedException ();
 
-			if (!m_stream.CanRead)
+			if (!m_stream.CanWrite)
 				throw new NotSupportedException ();
 			if (offset < 0)
 				throw new ArgumentOutOfRangeException ();

--------------080709030409050206040301--