* fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix typos in
comments. Always open file synchronized when reading header bytes, otherwise suffer stack corruption.
This commit is contained in:
parent
3449d470ba
commit
667d9ad130
@ -1,3 +1,9 @@
|
|||||||
|
2009-11-27 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix typos in
|
||||||
|
comments. Always open file synchronized when reading header bytes,
|
||||||
|
otherwise suffer stack corruption.
|
||||||
|
|
||||||
2009-11-26 Corinna Vinschen <corinna@vinschen.de>
|
2009-11-26 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* dtable.cc (dtable::stdio_init): Use GetCurrentProcess() rather than
|
* dtable.cc (dtable::stdio_init): Use GetCurrentProcess() rather than
|
||||||
|
@ -576,8 +576,8 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
|
|||||||
buf->st_blocks = (buf->st_size + S_BLKSIZE - 1) / S_BLKSIZE;
|
buf->st_blocks = (buf->st_size + S_BLKSIZE - 1) / S_BLKSIZE;
|
||||||
|
|
||||||
buf->st_mode = 0;
|
buf->st_mode = 0;
|
||||||
/* Using a side effect: get_file_attibutes checks for
|
/* Using a side effect: get_file_attributes checks for directory.
|
||||||
directory. This is used, to set S_ISVTX, if needed. */
|
This is used, to set S_ISVTX, if needed. */
|
||||||
if (pc.isdir ())
|
if (pc.isdir ())
|
||||||
buf->st_mode = S_IFDIR;
|
buf->st_mode = S_IFDIR;
|
||||||
else if (pc.issymlink ())
|
else if (pc.issymlink ())
|
||||||
@ -643,7 +643,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
|
|||||||
|| RtlEqualUnicodePathSuffix (path, &ro_u_com, TRUE))
|
|| RtlEqualUnicodePathSuffix (path, &ro_u_com, TRUE))
|
||||||
pc.set_exec ();
|
pc.set_exec ();
|
||||||
}
|
}
|
||||||
/* No known sufix, check file header. This catches binaries and
|
/* No known suffix, check file header. This catches binaries and
|
||||||
shebang scripts. */
|
shebang scripts. */
|
||||||
if (pc.exec_state () == dont_know_if_executable)
|
if (pc.exec_state () == dont_know_if_executable)
|
||||||
{
|
{
|
||||||
@ -653,8 +653,9 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
|
|||||||
|
|
||||||
InitializeObjectAttributes (&attr, &ro_u_empty, 0, get_handle (),
|
InitializeObjectAttributes (&attr, &ro_u_empty, 0, get_handle (),
|
||||||
NULL);
|
NULL);
|
||||||
if (NT_SUCCESS (NtOpenFile (&h, FILE_READ_DATA, &attr, &io,
|
if (NT_SUCCESS (NtOpenFile (&h, SYNCHRONIZE | FILE_READ_DATA,
|
||||||
FILE_SHARE_VALID_FLAGS, 0)))
|
&attr, &io, FILE_SHARE_VALID_FLAGS,
|
||||||
|
FILE_SYNCHRONOUS_IO_NONALERT)))
|
||||||
{
|
{
|
||||||
LARGE_INTEGER off = { QuadPart:0LL };
|
LARGE_INTEGER off = { QuadPart:0LL };
|
||||||
char magic[3];
|
char magic[3];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user