* 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>
|
2008-12-16 Christian Franke <franke@computer.org>
|
||||||
|
|
||||||
* fhandler_registry.cc (DEFAULT_VALUE_NAME): Remove constant.
|
* fhandler_registry.cc (DEFAULT_VALUE_NAME): Remove constant.
|
||||||
|
|
|
@ -2407,7 +2407,7 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = NtQueryDirectoryFile (dir, NULL, NULL, 0, &io,
|
status = NtQueryDirectoryFile (dir, NULL, NULL, NULL, &io,
|
||||||
&fdi_buf, sizeof fdi_buf,
|
&fdi_buf, sizeof fdi_buf,
|
||||||
FileDirectoryInformation,
|
FileDirectoryInformation,
|
||||||
TRUE, &basename, TRUE);
|
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
|
/* If searching for `foo' and then finding a `foo.lnk' which is
|
||||||
no shortcut, return the same as if file not found. */
|
no shortcut, return the same as if file not found. */
|
||||||
if (!suffix.lnk_match () || !ext_tacked_on)
|
if (ext_tacked_on)
|
||||||
goto file_not_symlink;
|
{
|
||||||
|
fileattr = INVALID_FILE_ATTRIBUTES;
|
||||||
/* in case we're going to tack *another* .lnk on this filename. */
|
set_error (ENOENT);
|
||||||
fileattr = INVALID_FILE_ATTRIBUTES;
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
}
|
||||||
if (contents[0] == ':' && contents[1] == '\\'
|
else if (contents[0] != ':' || contents[1] != '\\'
|
||||||
&& parse_device (contents))
|
|| !parse_device (contents))
|
||||||
goto file_not_symlink;
|
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
|
/* 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)
|
else if (fileattr & FILE_ATTRIBUTE_REPARSE_POINT)
|
||||||
{
|
{
|
||||||
res = check_reparse_point (h);
|
res = check_reparse_point (h);
|
||||||
if (!res)
|
if (res)
|
||||||
goto file_not_symlink;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is the old Cygwin method creating symlinks. A symlink will
|
/* 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)
|
== FILE_ATTRIBUTE_SYSTEM)
|
||||||
{
|
{
|
||||||
res = check_sysfile (h);
|
res = check_sysfile (h);
|
||||||
if (!res)
|
if (res)
|
||||||
goto file_not_symlink;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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
|
||||||
|
@ -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))
|
else if (fs.is_nfs () && !no_ea && !(fileattr & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
{
|
{
|
||||||
res = check_nfs_symlink (h);
|
res = check_nfs_symlink (h);
|
||||||
if (!res)
|
if (res)
|
||||||
goto file_not_symlink;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Normal file. */
|
/* Normal file. */
|
||||||
else
|
|
||||||
goto file_not_symlink;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
file_not_symlink:
|
file_not_symlink:
|
||||||
issymlink = false;
|
issymlink = false;
|
||||||
syscall_printf ("%s", isdevice ? "is a device" : "not a symlink");
|
syscall_printf ("%s", isdevice ? "is a device" : "not a symlink");
|
||||||
|
|
Loading…
Reference in New Issue