Author: dick
Date: 2005-04-13 12:10:04 -0400 (Wed, 13 Apr 2005)
New Revision: 42925
Modified:
trunk/mono/mono/io-layer/ChangeLog
trunk/mono/mono/io-layer/handles-private.h
trunk/mono/mono/io-layer/handles.c
trunk/mono/mono/io-layer/io.c
Log:
2005-04-13 Dick Porter <[EMAIL PROTECTED]>
* io.c (share_check):
* handles.c (_wapi_handle_check_share): Refine the file check so
that sharing violations within the same process don't cause
assertion failures.
Modified: trunk/mono/mono/io-layer/ChangeLog
===================================================================
--- trunk/mono/mono/io-layer/ChangeLog 2005-04-13 15:52:34 UTC (rev 42924)
+++ trunk/mono/mono/io-layer/ChangeLog 2005-04-13 16:10:04 UTC (rev 42925)
@@ -1,5 +1,12 @@
2005-04-13 Dick Porter <[EMAIL PROTECTED]>
+ * io.c (share_check):
+ * handles.c (_wapi_handle_check_share): Refine the file check so
+ that sharing violations within the same process don't cause
+ assertion failures.
+
+2005-04-13 Dick Porter <[EMAIL PROTECTED]>
+
* io.c (FindFirstFile): Fix bugs introduced with the merge (bug
74586)
Modified: trunk/mono/mono/io-layer/handles-private.h
===================================================================
--- trunk/mono/mono/io-layer/handles-private.h 2005-04-13 15:52:34 UTC (rev
42924)
+++ trunk/mono/mono/io-layer/handles-private.h 2005-04-13 16:10:04 UTC (rev
42925)
@@ -86,7 +86,8 @@
guint32 *old_sharemode,
guint32 *old_access,
struct _WapiFileShare **info);
-extern void _wapi_handle_check_share (struct _WapiFileShare *share_info);
+extern void _wapi_handle_check_share (struct _WapiFileShare *share_info,
+ int fd);
extern void _wapi_handle_dump (void);
extern void _wapi_handle_update_refs (void);
Modified: trunk/mono/mono/io-layer/handles.c
===================================================================
--- trunk/mono/mono/io-layer/handles.c 2005-04-13 15:52:34 UTC (rev 42924)
+++ trunk/mono/mono/io-layer/handles.c 2005-04-13 16:10:04 UTC (rev 42925)
@@ -1559,7 +1559,7 @@
* implement their own ways of finding out if a particular file is
* open by a process.
*/
-void _wapi_handle_check_share (struct _WapiFileShare *share_info)
+void _wapi_handle_check_share (struct _WapiFileShare *share_info, int fd)
{
DIR *proc_dir;
struct dirent *proc_entry;
@@ -1593,9 +1593,10 @@
while ((proc_entry = readdir (proc_dir)) != NULL) {
/* We only care about numerically-named directories */
pid = atoi (proc_entry->d_name);
- if (pid != 0 && pid != self) {
+ if (pid != 0) {
/* Look in /proc/<pid>/fd/ but ignore
- * ourselves, as we have the file open too
+ * /proc/<our pid>/fd/<fd>, as we have the
+ * file open too
*/
DIR *fd_dir;
struct dirent *fd_entry;
@@ -1614,7 +1615,9 @@
struct stat link_stat;
if (!strcmp (fd_entry->d_name, ".") ||
- !strcmp (fd_entry->d_name, "..")) {
+ !strcmp (fd_entry->d_name, "..") ||
+ (pid == self &&
+ fd == atoi (fd_entry->d_name))) {
continue;
}
Modified: trunk/mono/mono/io-layer/io.c
===================================================================
--- trunk/mono/mono/io-layer/io.c 2005-04-13 15:52:34 UTC (rev 42924)
+++ trunk/mono/mono/io-layer/io.c 2005-04-13 16:10:04 UTC (rev 42925)
@@ -1364,7 +1364,7 @@
static gboolean share_check (struct stat *statbuf, guint32 sharemode,
guint32 fileaccess,
- struct _WapiFileShare **share_info)
+ struct _WapiFileShare **share_info, int fd)
{
if (share_allows_open (statbuf, sharemode, fileaccess,
share_info) == TRUE) {
@@ -1379,7 +1379,7 @@
* collection.
*/
- _wapi_handle_check_share (*share_info);
+ _wapi_handle_check_share (*share_info, fd);
if (share_allows_open (statbuf, sharemode, fileaccess,
share_info) == TRUE) {
return (TRUE);
@@ -1520,7 +1520,7 @@
}
if (share_check (&statbuf, sharemode, fileaccess,
- &file_handle.share_info) == FALSE) {
+ &file_handle.share_info, fd) == FALSE) {
SetLastError (ERROR_SHARING_VIOLATION);
g_free (filename);
close (fd);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches