diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-12-20 12:35:18 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2008-12-20 12:35:18 +0300 |
commit | e9982f2a2b1b43489985b071adc86c90ccbbfcb0 (patch) | |
tree | d016d74867b7d0ae7addf756d2266f1eab285bac /winsup/cygwin/uinfo.cc | |
parent | 99c7be03b2f080751c741b392779641fa1d38911 (diff) |
* pwdgrp.h (pwdgrp::refresh): Fix indentation.
* uinfo.cc (pwdgrp::load): Open file synchronized to avoid truncated
read. Drop local variable off.
Diffstat (limited to 'winsup/cygwin/uinfo.cc')
-rw-r--r-- | winsup/cygwin/uinfo.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index f9ed1a686..9b6733f22 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -516,7 +516,6 @@ pwdgrp::load (const wchar_t *rel_path) static const char succeeded[] = "succeeded"; const char *res = failed; HANDLE fh = NULL; - LARGE_INTEGER off = { QuadPart:0LL }; NTSTATUS status; OBJECT_ATTRIBUTES attr; @@ -543,8 +542,8 @@ pwdgrp::load (const wchar_t *rel_path) paranoid_printf ("%S", &upath); - status = NtOpenFile (&fh, FILE_READ_DATA, &attr, &io, - FILE_SHARE_VALID_FLAGS, 0); + status = NtOpenFile (&fh, SYNCHRONIZE | FILE_READ_DATA, &attr, &io, + FILE_SHARE_VALID_FLAGS, FILE_SYNCHRONOUS_IO_NONALERT); if (!NT_SUCCESS (status)) { paranoid_printf ("NtOpenFile(%S) failed, status %p", &upath, status); @@ -568,8 +567,8 @@ pwdgrp::load (const wchar_t *rel_path) paranoid_printf ("malloc (%d) failed", fsi.EndOfFile.LowPart); goto out; } - status = NtReadFile (fh, NULL, NULL, NULL, &io, buf, - fsi.EndOfFile.LowPart, &off, NULL); + status = NtReadFile (fh, NULL, NULL, NULL, &io, buf, fsi.EndOfFile.LowPart, + NULL, NULL); if (!NT_SUCCESS (status)) { paranoid_printf ("NtReadFile(%S) failed, status %p", &upath, status); |