[pypy-svn] r33432 - pypy/dist/pypy/translator/cli/src

antocuni at codespeak.net antocuni at codespeak.net
Thu Oct 19 00:18:30 CEST 2006


Author: antocuni
Date: Thu Oct 19 00:18:29 2006
New Revision: 33432

Modified:
   pypy/dist/pypy/translator/cli/src/ll_os.cs
Log:
Raise OSError instead of crashing
 


Modified: pypy/dist/pypy/translator/cli/src/ll_os.cs
==============================================================================
--- pypy/dist/pypy/translator/cli/src/ll_os.cs	(original)
+++ pypy/dist/pypy/translator/cli/src/ll_os.cs	Thu Oct 19 00:18:29 2006
@@ -298,7 +298,15 @@
             if (path == "")
                 raise_OSError(Errno.ENOENT, "No such file or directory: ''");
 
-            FileInfo f = new FileInfo(path);
+            FileInfo f;
+            try {
+                f = new FileInfo(path);
+            }
+            catch(System.ArgumentException e) {
+                raise_OSError(Errno.EINVAL, e.Message);
+                return null;
+            }
+
             if (f.Exists) {
                 Record_Stat_Result res = new Record_Stat_Result();
                 TimeSpan t = File.GetLastWriteTime(path) - new DateTime(1970, 1, 1);



More information about the Pypy-commit mailing list