aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-11-27 14:27:22 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-11-27 14:27:22 +0000
commit667d9ad13091559cd3888b903964ea91ba76b4de (patch)
tree3a7ea4e1eae780ca129923c0de28dc811bbf30cc /winsup
parent3449d470ba41473b7a9c631c481a1fa9fbe9f11c (diff)
downloadnewlib-667d9ad13091559cd3888b903964ea91ba76b4de.zip
newlib-667d9ad13091559cd3888b903964ea91ba76b4de.tar.gz
newlib-667d9ad13091559cd3888b903964ea91ba76b4de.tar.bz2
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix typos in
comments. Always open file synchronized when reading header bytes, otherwise suffer stack corruption.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc11
2 files changed, 12 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 923c578..b0daf5f 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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>
* dtable.cc (dtable::stdio_init): Use GetCurrentProcess() rather than
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 15e4739..1ae9f9e 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -576,8 +576,8 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
buf->st_blocks = (buf->st_size + S_BLKSIZE - 1) / S_BLKSIZE;
buf->st_mode = 0;
- /* Using a side effect: get_file_attibutes checks for
- directory. This is used, to set S_ISVTX, if needed. */
+ /* Using a side effect: get_file_attributes checks for directory.
+ This is used, to set S_ISVTX, if needed. */
if (pc.isdir ())
buf->st_mode = S_IFDIR;
else if (pc.issymlink ())
@@ -643,7 +643,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
|| RtlEqualUnicodePathSuffix (path, &ro_u_com, TRUE))
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. */
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 (),
NULL);
- if (NT_SUCCESS (NtOpenFile (&h, FILE_READ_DATA, &attr, &io,
- FILE_SHARE_VALID_FLAGS, 0)))
+ if (NT_SUCCESS (NtOpenFile (&h, SYNCHRONIZE | FILE_READ_DATA,
+ &attr, &io, FILE_SHARE_VALID_FLAGS,
+ FILE_SYNCHRONOUS_IO_NONALERT)))
{
LARGE_INTEGER off = { QuadPart:0LL };
char magic[3];