* fhandler_disk_file.cc (fhandler_disk_file::closedir): Add dir name

to debug output.
	* syscalls.cc (try_to_bin): Enable code to move file to user specific
	recycler dir to eliminate Vista problem.
	(unlink_nt): Add comment that rename after opening for delete on close
	only fails on XP.
This commit is contained in:
Corinna Vinschen 2007-01-31 10:55:59 +00:00
parent ff2a198b68
commit c3772e717f
3 changed files with 21 additions and 9 deletions

View File

@ -1,3 +1,12 @@
2007-01-30 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::closedir): Add dir name
to debug output.
* syscalls.cc (try_to_bin): Enable code to move file to user specific
recycler dir to eliminate Vista problem.
(unlink_nt): Add comment that rename after opening for delete on close
only fails on XP.
2007-01-30 Corinna Vinschen <corinna@vinschen.de> 2007-01-30 Corinna Vinschen <corinna@vinschen.de>
* sigproc.cc (child_info::child_info): Set msv_count to non-zero * sigproc.cc (child_info::child_info): Set msv_count to non-zero

View File

@ -2046,7 +2046,7 @@ fhandler_disk_file::closedir (DIR *dir)
res = -1; res = -1;
} }
} }
syscall_printf ("%d = closedir (%p)", res, dir); syscall_printf ("%d = closedir (%p, %s)", res, dir, get_name ());
return res; return res;
} }

View File

@ -180,12 +180,13 @@ try_to_bin (path_conv &win32_path, HANDLE h)
FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN); FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
} }
#if 0 /* Up to Windows 2003 Server, the default settings for the top level recycle
/* The default settings for the top level recycle bin are so that bin are so that everybody has the right to create files in it. Starting
everybody has the right to create files in it. Should that be with Vista, users are by default not allowed to create files in that
insufficient at one point, we can enable the following code to directory, only subdirectories. Too bad, but that requires to move
move the file into the user's own bin subdir. At this point, files to the user's own recycler subdir. Instead of adding yet another
I'm going to opt for speed, though. */ special case, we just move the stuff to the user's recycler, especially
since only shared files are moved at all. */
if (win32_path.fs_is_ntfs ()) if (win32_path.fs_is_ntfs ())
{ {
*c++ = '\\'; *c++ = '\\';
@ -205,7 +206,6 @@ try_to_bin (path_conv &win32_path, HANDLE h)
FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN); FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
} }
} }
#endif
/* Create hopefully unique filename. */ /* Create hopefully unique filename. */
__small_sprintf (c, "\\cyg%016X", hash_path_name (myself->uid, __small_sprintf (c, "\\cyg%016X", hash_path_name (myself->uid,
@ -253,7 +253,10 @@ unlink_nt (path_conv &win32_name, bool setattrs)
is opened "delete on close", the rename operation in try_to_bin fails is opened "delete on close", the rename operation in try_to_bin fails
with STATUS_ACCESS_DENIED. So directories must be deleted using with STATUS_ACCESS_DENIED. So directories must be deleted using
NtSetInformationFile, class FileDispositionInformation, which works fine. NtSetInformationFile, class FileDispositionInformation, which works fine.
Correction, moving a directory opened with delete-on-close fails ONLY
on XP. Note to myself: Never take anything for granted on Windows!
Don't try "delete on close" if the file is on a remote share. If two Don't try "delete on close" if the file is on a remote share. If two
processes have open handles on a file and one of them calls unlink, then processes have open handles on a file and one of them calls unlink, then
it happens that the file is removed from the remote share even though the it happens that the file is removed from the remote share even though the