* pwdgrp.h (pwdgrp::refresh): Fix indentation.

* uinfo.cc (pwdgrp::load): Open file synchronized to avoid truncated
	read.  Drop local variable off.
This commit is contained in:
Corinna Vinschen 2008-12-20 09:35:18 +00:00
parent 99c7be03b2
commit e9982f2a2b
3 changed files with 11 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2008-12-20 Corinna Vinschen <corinna@vinschen.de>
* pwdgrp.h (pwdgrp::refresh): Fix indentation.
* uinfo.cc (pwdgrp::load): Open file synchronized to avoid truncated
read. Drop local variable off.
2008-12-19 Christopher Faylor <me+cygwin@cgf.cx> 2008-12-19 Christopher Faylor <me+cygwin@cgf.cx>
* pinfo.cc (pinfo_basic): New class. * pinfo.cc (pinfo_basic): New class.

View file

@ -75,7 +75,7 @@ public:
return; return;
if (pglock.acquire () == 1 && if (pglock.acquire () == 1 &&
(!initialized || (check && etc::file_changed (etc_ix)))) (!initialized || (check && etc::file_changed (etc_ix))))
(this->*read) (); (this->*read) ();
pglock.release (); pglock.release ();
} }

View file

@ -516,7 +516,6 @@ pwdgrp::load (const wchar_t *rel_path)
static const char succeeded[] = "succeeded"; static const char succeeded[] = "succeeded";
const char *res = failed; const char *res = failed;
HANDLE fh = NULL; HANDLE fh = NULL;
LARGE_INTEGER off = { QuadPart:0LL };
NTSTATUS status; NTSTATUS status;
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
@ -543,8 +542,8 @@ pwdgrp::load (const wchar_t *rel_path)
paranoid_printf ("%S", &upath); paranoid_printf ("%S", &upath);
status = NtOpenFile (&fh, FILE_READ_DATA, &attr, &io, status = NtOpenFile (&fh, SYNCHRONIZE | FILE_READ_DATA, &attr, &io,
FILE_SHARE_VALID_FLAGS, 0); FILE_SHARE_VALID_FLAGS, FILE_SYNCHRONOUS_IO_NONALERT);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
paranoid_printf ("NtOpenFile(%S) failed, status %p", &upath, 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); paranoid_printf ("malloc (%d) failed", fsi.EndOfFile.LowPart);
goto out; goto out;
} }
status = NtReadFile (fh, NULL, NULL, NULL, &io, buf, status = NtReadFile (fh, NULL, NULL, NULL, &io, buf, fsi.EndOfFile.LowPart,
fsi.EndOfFile.LowPart, &off, NULL); NULL, NULL);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
paranoid_printf ("NtReadFile(%S) failed, status %p", &upath, status); paranoid_printf ("NtReadFile(%S) failed, status %p", &upath, status);