[Sockets] Support Remote/LocalEndPoint for AF_UNIX
[mono.git] / mcs / class / Mono.Posix / Mono.Unix / StdioFileStream.cs
index 42b83f13922c861d3f9aaf0f6734bc93636efc6a..7eed08157b0748ff075ad7bcc362aa8709d4b74a 100644 (file)
@@ -4,7 +4,7 @@
 // Authors:
 //   Jonathan Pryor (jonpryor@vt.edu)
 //
-// (C) 2005 Jonathan Pryor
+// (C) 2005-2006 Jonathan Pryor
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -60,7 +60,7 @@ namespace Mono.Unix {
 
                public StdioFileStream (string path)
                {
-                       InitStream (Fopen (path, "r"), true);
+                       InitStream (Fopen (path, "rb"), true);
                }
 
                public StdioFileStream (string path, string mode)
@@ -92,7 +92,7 @@ namespace Mono.Unix {
                        if (path.Length == 0)
                                throw new ArgumentException ("path");
                        if (mode == null)
-                               throw new ArgumentNullException ("path");
+                               throw new ArgumentNullException ("mode");
                        IntPtr f = Native.Stdlib.fopen (path, mode);
                        if (f == IntPtr.Zero)
                                throw new DirectoryNotFoundException ("path", 
@@ -120,7 +120,7 @@ namespace Mono.Unix {
                                        canWrite = true;  
                                Native.Stdlib.clearerr (file);
                        }
-                       catch (Exception e) {
+                       catch (Exception) {
                                throw new ArgumentException (Locale.GetText ("Invalid file stream"), "fileStream");
                        }
                        GC.KeepAlive (this);
@@ -182,6 +182,7 @@ namespace Mono.Unix {
                {
                        if (file == InvalidFileStream)
                                throw new ObjectDisposedException ("Invalid File Stream");
+                       GC.KeepAlive (this);
                }
 
                public IntPtr Handle {
@@ -244,15 +245,6 @@ namespace Mono.Unix {
                        }
                }
 
-               [Obsolete ("Use SaveFilePosition (Mono.Unix.Native.FilePosition)", true)]
-               public void SaveFilePosition (FilePosition pos)
-               {
-                       AssertNotDisposed ();
-                       int r = Stdlib.fgetpos (file, pos);
-                       UnixMarshal.ThrowExceptionForLastErrorIf (r);
-                       GC.KeepAlive (this);
-               }
-
                public void SaveFilePosition (Native.FilePosition pos)
                {
                        AssertNotDisposed ();
@@ -261,17 +253,6 @@ namespace Mono.Unix {
                        GC.KeepAlive (this);
                }
 
-               [Obsolete ("Use RestoreFilePosition (Mono.Unix.Native.FilePosition)", true)]
-               public void RestoreFilePosition (FilePosition pos)
-               {
-                       AssertNotDisposed ();
-                       if (pos == null)
-                               throw new ArgumentNullException ("value");
-                       int r = Stdlib.fsetpos (file, pos);
-                       UnixMarshal.ThrowExceptionForLastErrorIf (r);
-                       GC.KeepAlive (this);
-               }
-
                public void RestoreFilePosition (Native.FilePosition pos)
                {
                        AssertNotDisposed ();