Improve/fix SerialStream.Dispose (dotnet/corefx#33221)
authorKrzysztof Wicher <mordotymoja@gmail.com>
Mon, 5 Nov 2018 18:48:53 +0000 (10:48 -0800)
committerJan Kotas <jkotas@microsoft.com>
Mon, 5 Nov 2018 23:34:39 +0000 (15:34 -0800)
* Improve/fix SerialStream.Dispose

* Review feedback

* remove unused using statement

* Use ToFileDescriptor

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
src/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Read.cs
src/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Write.cs

index 1be5e789c209eaae15d4eb307a02053346d7f18c..233feabdbb6958c303ed5d2f9a02933a0bc8dc5b 100644 (file)
@@ -20,6 +20,6 @@ internal static partial class Interop
         /// Note - on fail. the position of the stream may change depending on the platform; consult man 2 read for more info
         /// </returns>
         [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Read", SetLastError = true)]
-        internal static extern unsafe int Read(SafeFileHandle fd, byte* buffer, int count);
+        internal static extern unsafe int Read(SafeHandle fd, byte* buffer, int count);
     }
 }
index 0636615a8b85204ee3305af8dcbb840b8663e3c3..fb06d463beb762f0671ba5e500df6336481f9563 100644 (file)
@@ -19,7 +19,7 @@ internal static partial class Interop
         /// Returns the number of bytes written on success; otherwise, returns -1 and sets errno
         /// </returns>
         [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)]
-        internal static extern unsafe int Write(SafeFileHandle fd, byte* buffer, int bufferSize);
+        internal static extern unsafe int Write(SafeHandle fd, byte* buffer, int bufferSize);
 
         [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)]
         internal static extern unsafe int Write(int fd, byte* buffer, int bufferSize);