* path.cc (symlin_info::check): Set 4th parameter of
NtQueryDirectoryFile to NULL instead of 0 since it's a pointer. Simplify label and break from loop handling in symlink evaluation conditional expression. Drop a now useless break statement. Fix behaviour when searching for `foo' and then finding a `foo.lnk' which is no shortcut.
This commit is contained in:
parent
676c617704
commit
dc7dfa3a82
|
@ -1,3 +1,12 @@
|
|||
2008-12-18 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* path.cc (symlin_info::check): Set 4th parameter of
|
||||
NtQueryDirectoryFile to NULL instead of 0 since it's a pointer.
|
||||
Simplify label and break from loop handling in symlink evaluation
|
||||
conditional expression. Drop a now useless break statement. Fix
|
||||
behaviour when searching for `foo' and then finding a `foo.lnk'
|
||||
which is no shortcut.
|
||||
|
||||
2008-12-16 Christian Franke <franke@computer.org>
|
||||
|
||||
* fhandler_registry.cc (DEFAULT_VALUE_NAME): Remove constant.
|
||||
|
|
|
@ -2407,7 +2407,7 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt,
|
|||
}
|
||||
else
|
||||
{
|
||||
status = NtQueryDirectoryFile (dir, NULL, NULL, 0, &io,
|
||||
status = NtQueryDirectoryFile (dir, NULL, NULL, NULL, &io,
|
||||
&fdi_buf, sizeof fdi_buf,
|
||||
FileDirectoryInformation,
|
||||
TRUE, &basename, TRUE);
|
||||
|
@ -2458,16 +2458,25 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt,
|
|||
{
|
||||
/* If searching for `foo' and then finding a `foo.lnk' which is
|
||||
no shortcut, return the same as if file not found. */
|
||||
if (!suffix.lnk_match () || !ext_tacked_on)
|
||||
goto file_not_symlink;
|
||||
|
||||
/* in case we're going to tack *another* .lnk on this filename. */
|
||||
if (ext_tacked_on)
|
||||
{
|
||||
fileattr = INVALID_FILE_ATTRIBUTES;
|
||||
set_error (ENOENT);
|
||||
continue;
|
||||
}
|
||||
if (contents[0] == ':' && contents[1] == '\\'
|
||||
&& parse_device (contents))
|
||||
goto file_not_symlink;
|
||||
}
|
||||
else if (contents[0] != ':' || contents[1] != '\\'
|
||||
|| !parse_device (contents))
|
||||
break;
|
||||
}
|
||||
|
||||
/* If searching for `foo' and then finding a `foo.lnk' which is
|
||||
no shortcut, return the same as if file not found. */
|
||||
else if (suffix.lnk_match () && ext_tacked_on)
|
||||
{
|
||||
fileattr = INVALID_FILE_ATTRIBUTES;
|
||||
set_error (ENOENT);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Reparse points are potentially symlinks. This check must be
|
||||
|
@ -2478,8 +2487,8 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt,
|
|||
else if (fileattr & FILE_ATTRIBUTE_REPARSE_POINT)
|
||||
{
|
||||
res = check_reparse_point (h);
|
||||
if (!res)
|
||||
goto file_not_symlink;
|
||||
if (res)
|
||||
break;
|
||||
}
|
||||
|
||||
/* This is the old Cygwin method creating symlinks. A symlink will
|
||||
|
@ -2489,8 +2498,8 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt,
|
|||
== FILE_ATTRIBUTE_SYSTEM)
|
||||
{
|
||||
res = check_sysfile (h);
|
||||
if (!res)
|
||||
goto file_not_symlink;
|
||||
if (res)
|
||||
break;
|
||||
}
|
||||
|
||||
/* If the file could be opened with FILE_READ_EA, and if it's on a
|
||||
|
@ -2499,17 +2508,11 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt,
|
|||
else if (fs.is_nfs () && !no_ea && !(fileattr & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
res = check_nfs_symlink (h);
|
||||
if (!res)
|
||||
goto file_not_symlink;
|
||||
if (res)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Normal file. */
|
||||
else
|
||||
goto file_not_symlink;
|
||||
|
||||
break;
|
||||
|
||||
|
||||
file_not_symlink:
|
||||
issymlink = false;
|
||||
syscall_printf ("%s", isdevice ? "is a device" : "not a symlink");
|
||||
|
|
Loading…
Reference in New Issue