* path.cc (symlink_info::check): Define eabuf and easize outside of

loop.  Set to NULL on first STATUS_EAS_NOT_SUPPORTED.  Align comments.
	Fix formatting.
This commit is contained in:
Corinna Vinschen 2008-05-23 11:00:35 +00:00
parent b4ea313a85
commit 1870c68806
2 changed files with 3461 additions and 3456 deletions

View File

@ -1,3 +1,9 @@
2008-05-22 Corinna Vinschen <corinna@vinschen.de>
* path.cc (symlink_info::check): Define eabuf and easize outside of
loop. Set to NULL on first STATUS_EAS_NOT_SUPPORTED. Align comments.
Fix formatting.
2008-05-22 Corinna Vinschen <corinna@vinschen.de> 2008-05-22 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Eliminate * fhandler_disk_file.cc (fhandler_disk_file::readdir): Eliminate

View File

@ -2342,6 +2342,9 @@
tp.u_get (&upath); tp.u_get (&upath);
InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE, NULL, NULL); InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE, NULL, NULL);
void *eabuf = &nfs_aol_ffei;
ULONG easize = sizeof nfs_aol_ffei;
while (suffix.next ()) while (suffix.next ())
{ {
FILE_BASIC_INFORMATION fbi; FILE_BASIC_INFORMATION fbi;
@ -2359,7 +2362,7 @@
/* The EA given to NtCreateFile allows to get a handle to a symlink on /* The EA given to NtCreateFile allows to get a handle to a symlink on
an NFS share, rather than getting a handle to the target of the an NFS share, rather than getting a handle to the target of the
symlink (which would spoil the task of this method quite a bit). symlink (which would spoil the task of this method quite a bit).
Fortunately it's ignored on other file systems so we don't have Fortunately it's ignored on most other file systems so we don't have
to special case NFS too much. */ to special case NFS too much. */
status = NtCreateFile (&h, status = NtCreateFile (&h,
READ_CONTROL | FILE_READ_ATTRIBUTES | FILE_READ_EA, READ_CONTROL | FILE_READ_ATTRIBUTES | FILE_READ_EA,
@ -2367,22 +2370,18 @@
FILE_SHARE_VALID_FLAGS, FILE_OPEN, FILE_SHARE_VALID_FLAGS, FILE_OPEN,
FILE_OPEN_REPARSE_POINT FILE_OPEN_REPARSE_POINT
| FILE_OPEN_FOR_BACKUP_INTENT, | FILE_OPEN_FOR_BACKUP_INTENT,
&nfs_aol_ffei, sizeof nfs_aol_ffei); eabuf, easize);
if (status == STATUS_ACCESS_DENIED || status == STATUS_EAS_NOT_SUPPORTED) /* No right to access EAs? */ /* No right to access EAs or EAs not supported? */
if (status == STATUS_ACCESS_DENIED || status == STATUS_EAS_NOT_SUPPORTED)
{ {
no_ea = true; no_ea = true;
void *eabuf; /* If EAs are not supported, there's no sense to check them again
ULONG easize; whith suffixes attached. So we set eabuf/easize to 0 here once. */
if (status == STATUS_EAS_NOT_SUPPORTED) if (status == STATUS_EAS_NOT_SUPPORTED)
{ {
eabuf = NULL; eabuf = NULL;
easize = 0; easize = 0;
} }
else
{
eabuf = (void *) &nfs_aol_ffei;
easize = sizeof nfs_aol_ffei;
}
status = NtCreateFile (&h, status = NtCreateFile (&h,
READ_CONTROL | FILE_READ_ATTRIBUTES, READ_CONTROL | FILE_READ_ATTRIBUTES,
&attr, &io, NULL, FILE_ATTRIBUTE_NORMAL, &attr, &io, NULL, FILE_ATTRIBUTE_NORMAL,
@ -2529,7 +2528,7 @@
/* If the file could be opened with FILE_READ_EA, and if it's on a /* If the file could be opened with FILE_READ_EA, and if it's on a
NFS share, check if it's a symlink. Only files can be symlinks NFS share, check if it's a symlink. Only files can be symlinks
(which can be symlinks to directories). */ (which can be symlinks to directories). */
else if (!no_ea && !(fileattr & FILE_ATTRIBUTE_DIRECTORY) && fs.is_nfs ()) else if (!eabuf && !(fileattr & FILE_ATTRIBUTE_DIRECTORY) && fs.is_nfs ())
{ {
res = check_nfs_symlink (h); res = check_nfs_symlink (h);
if (!res) if (!res)