You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2007/06/06 14:27:18 UTC

svn commit: r544824 - in /harmony/enhanced/classlib/trunk/modules: luni/src/test/java/tests/api/java/io/FileOutputStreamTest.java portlib/src/main/native/port/windows/hyfile.c

Author: tellison
Date: Wed Jun  6 05:27:18 2007
New Revision: 544824

URL: http://svn.apache.org/viewvc?view=rev&rev=544824
Log:
Apply patch HARMONY-4012 ([classlib][luni] OSFileSystem.open can't open system special files(nul))

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileOutputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileOutputStreamTest.java?view=diff&rev=544824&r1=544823&r2=544824
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileOutputStreamTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileOutputStreamTest.java Wed Jun  6 05:27:18 2007
@@ -68,7 +68,10 @@
         // Test for method java.io.FileOutputStream(java.lang.String)
         f = new File(fileName = System.getProperty("user.home"), "fos.tst");
         fileName = f.getAbsolutePath();
-        fos = new java.io.FileOutputStream(f);
+        fos = new FileOutputStream(fileName);
+
+        // Regression test for HARMONY-4012
+        new FileOutputStream("nul");
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c?view=diff&rev=544824&r1=544823&r2=544824
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c (original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c Wed Jun  6 05:27:18 2007
@@ -504,7 +504,7 @@
       return -1;
     }
 
-  if ((flags & HyOpenTruncate) == HyOpenTruncate)
+  if ((GetFileType(aHandle) == FILE_TYPE_DISK) && ((flags & HyOpenTruncate) == HyOpenTruncate))
     {
       if (0 == CloseHandle (aHandle))
 	{