[Mono-bugs] [Bug 531613] System.Diagnostics.Process StandardInput stream doesn't handle short writes properly

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Aug 17 02:48:36 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=531613

User brian at sooloos.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=531613#c1





--- Comment #1 from Brian Luczkiewicz <brian at sooloos.com>  2009-08-17 00:48:35 MDT ---
I modified mono-2.4 with the following patch and found that my issue was
resolved:

--- mcs/class/corlib/System.IO/FileStream.cs.bak    2009-08-17
02:35:00.000000000 -0400
+++ mcs/class/corlib/System.IO/FileStream.cs    2009-08-17 02:38:05.000000000
-0400
@@ -634,6 +634,22 @@

             WriteInternal (array, offset, count);
         }
+        
+        private void WriteFull (IntPtr handle, [In] byte [] src,
+                                int offset, int count,
+                                out MonoIOError error)
+        {
+            error = MonoIOError.ERROR_SUCCESS;
+
+            while (count > 0)
+            {
+                int written = MonoIO.Write (handle, src, offset, count, out
error);
+                if (error != MonoIOError.ERROR_SUCCESS)
+                    return;
+                count -= written;
+                offset += written;
+            }
+        }

         void WriteInternal (byte [] src, int offset, int count)
         {
@@ -643,7 +659,7 @@

                 FlushBuffer ();

-                MonoIO.Write (handle, src, offset, count, out error);
+                WriteFull (handle, src, offset, count, out error);
                 if (error != MonoIOError.ERROR_SUCCESS) {
                     // don't leak the path information for isolated storage
                     string fname = (anonymous) ? Path.GetFileName (name) :
name;
@@ -1022,8 +1038,8 @@
                         throw MonoIO.GetException (fname, error);
                     }
                 }
-                MonoIO.Write (handle, buf, 0,
-                          buf_length, out error);
+                WriteFull (handle, buf, 0,
+                           buf_length, out error);

                 if (error != MonoIOError.ERROR_SUCCESS) {
                     // don't leak the path information for isolated storage

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list