Don't invoke libc uname() on non-Unix systems
authorJeffrey Stedfast <jeff@xamarin.com>
Tue, 26 Jul 2011 22:40:38 +0000 (18:40 -0400)
committerJeffrey Stedfast <jeff@xamarin.com>
Tue, 26 Jul 2011 22:40:38 +0000 (18:40 -0400)
mcs/class/System/System/Platform.cs

index a953e83a31c4a61d7c8efca7423dced952bf44c6..823063b5624b2854e829d362c09c5f3b5b7b1701 100644 (file)
@@ -23,6 +23,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System;
 using System.Runtime.InteropServices;
 
 namespace System {
@@ -35,6 +36,9 @@ namespace System {
                
                public static bool IsMacOS {
                        get {
+                               if (Environment.OSVersion.Platform != PlatformID.Unix)
+                                       return false;
+
                                if (!checkedIsMacOS) {
                                        IntPtr buf = Marshal.AllocHGlobal (8192);
                                        if (uname (buf) == 0) {