Author: gonzalo
Date: 2006-10-04 18:02:15 -0400 (Wed, 04 Oct 2006)
New Revision: 66273

Modified:
   trunk/mcs/class/System/System.IO/ChangeLog
   trunk/mcs/class/System/System.IO/InotifyWatcher.cs
Log:
2006-10-04 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * InotifyWatcher.cs: workaround for a weird case. Someone is watching
        /dev with recursion enabled and the inotify file descriptor shows up
        as a directory that fails to open. Already reported to Robert Love.



Modified: trunk/mcs/class/System/System.IO/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.IO/ChangeLog  2006-10-04 21:37:34 UTC (rev 
66272)
+++ trunk/mcs/class/System/System.IO/ChangeLog  2006-10-04 22:02:15 UTC (rev 
66273)
@@ -1,3 +1,9 @@
+2006-10-04 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * InotifyWatcher.cs: workaround for a weird case. Someone is watching
+       /dev with recursion enabled and the inotify file descriptor shows up
+       as a directory that fails to open. Already reported to Robert Love.
+
 2006-09-05 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * InotifyWatcher.cs: fix file names for the rename event.

Modified: trunk/mcs/class/System/System.IO/InotifyWatcher.cs
===================================================================
--- trunk/mcs/class/System/System.IO/InotifyWatcher.cs  2006-10-04 21:37:34 UTC 
(rev 66272)
+++ trunk/mcs/class/System/System.IO/InotifyWatcher.cs  2006-10-04 22:02:15 UTC 
(rev 66273)
@@ -154,12 +154,14 @@
                                        data.SubDirs = new Hashtable ();
 
                                data.Enabled = true;
-                               StartMonitoringDirectory (data, false);
-                               lock (this) {
-                                       watches [fsw] = data;
-                                       AppendRequestData (data);
-                                       stop = false;
-                               }
+                               try {
+                                       StartMonitoringDirectory (data, false);
+                                       lock (this) {
+                                               watches [fsw] = data;
+                                               AppendRequestData (data);
+                                               stop = false;
+                                       }
+                               } catch {} // ignore the directory if 
StartMonitoringDirectory fails.
                        }
                }
                
@@ -292,9 +294,11 @@
                                                }
                                        }
 
-                                       StartMonitoringDirectory (fd, 
justcreated);
-                                       fd.SubDirs [directory] = fd;
-                                       AppendRequestData (fd);
+                                       try {
+                                               StartMonitoringDirectory (fd, 
justcreated);
+                                               fd.SubDirs [directory] = fd;
+                                               AppendRequestData (fd);
+                                       } catch {} // ignore errors and don't 
add directory.
                                }
                        }
 
@@ -562,11 +566,13 @@
                                for (int n = 0; n < count; n += 2) {
                                        InotifyData newdir = (InotifyData) 
newdirs [n];
                                        InotifyData parent = (InotifyData) 
newdirs [n + 1];
-                                       StartMonitoringDirectory (newdir, true);
-                                       AppendRequestData (newdir);
-                                       lock (parent) {
-                                               parent.SubDirs 
[newdir.Directory] = newdir;
-                                       }
+                                       try {
+                                               StartMonitoringDirectory 
(newdir, true);
+                                               AppendRequestData (newdir);
+                                               lock (parent) {
+                                                       parent.SubDirs 
[newdir.Directory] = newdir;
+                                               }
+                                       } catch {} // ignore the given directory
                                }
                                newdirs.Clear ();
                        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to