From f1817d368a9242d2e6473da9003f4a4a908cf1e7 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 10 Jan 2010 11:12:52 +0000 Subject: [PATCH] * fhandler.h (fhandler_base::fstat_helper): Declare timestamps as PLARGE_INTEGER. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Accommodate fstat_helper change of timestamp arguments. (fhandler_base::fstat_by_name): Ditto. (fhandler_base::fstat_helper): Define with timestamps as PLARGE_INTEGER. Accommodate in call to to_timestruc_t. --- winsup/cygwin/ChangeLog | 10 ++++++ winsup/cygwin/fhandler.h | 10 +++--- winsup/cygwin/fhandler_disk_file.cc | 50 ++++++++++++++--------------- 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 8c1455c1c..a4ddcc7d2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,13 @@ +2010-01-10 Corinna Vinschen + + * fhandler.h (fhandler_base::fstat_helper): Declare timestamps as + PLARGE_INTEGER. + * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): + Accommodate fstat_helper change of timestamp arguments. + (fhandler_base::fstat_by_name): Ditto. + (fhandler_base::fstat_helper): Define with timestamps as PLARGE_INTEGER. + Accommodate in call to to_timestruc_t. + 2010-01-08 Corinna Vinschen * sec_auth.cc (get_token_group_sidlist): Add BUILTIN\Users account diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 0974e61c6..60fe5fbf4 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1,7 +1,7 @@ /* fhandler.h Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. This file is part of Cygwin. @@ -280,10 +280,10 @@ class fhandler_base virtual int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2))); int __stdcall fstat_fs (struct __stat64 *buf) __attribute__ ((regparm (2))); int __stdcall fstat_helper (struct __stat64 *buf, - FILETIME ftChangeTime, - FILETIME ftLastAccessTime, - FILETIME ftLastWriteTime, - FILETIME ftCreationTime, + PLARGE_INTEGER ChangeTime, + PLARGE_INTEGER LastAccessTime, + PLARGE_INTEGER LastWriteTime, + PLARGE_INTEGER CreationTime, DWORD dwVolumeSerialNumber, ULONGLONG nFileSize, LONGLONG nAllocSize, diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 1ae9f9ea9..797f42063 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1,7 +1,7 @@ /* fhandler_disk_file.cc Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. This file is part of Cygwin. @@ -372,12 +372,11 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf) fbi.FileAttributes &= ~FILE_ATTRIBUTE_DIRECTORY; pc.file_attributes (fbi.FileAttributes); return fstat_helper (buf, - fbi.ChangeTime.QuadPart - ? *(FILETIME *) (void *) &fbi.ChangeTime - : *(FILETIME *) (void *) &fbi.LastWriteTime, - *(FILETIME *) (void *) &fbi.LastAccessTime, - *(FILETIME *) (void *) &fbi.LastWriteTime, - *(FILETIME *) (void *) &fbi.CreationTime, + fbi.ChangeTime.QuadPart ? &fbi.ChangeTime + : &fbi.LastWriteTime, + &fbi.LastAccessTime, + &fbi.LastWriteTime, + &fbi.CreationTime, get_dev (), fsi.EndOfFile.QuadPart, fsi.AllocationSize.QuadPart, @@ -440,12 +439,11 @@ fhandler_base::fstat_by_name (struct __stat64 *buf) fdi_buf.fdi.FileAttributes &= ~FILE_ATTRIBUTE_DIRECTORY; pc.file_attributes (fdi_buf.fdi.FileAttributes); return fstat_helper (buf, - fdi_buf.fdi.ChangeTime.QuadPart ? - *(FILETIME *) (void *) &fdi_buf.fdi.ChangeTime : - *(FILETIME *) (void *) &fdi_buf.fdi.LastWriteTime, - *(FILETIME *) (void *) &fdi_buf.fdi.LastAccessTime, - *(FILETIME *) (void *) &fdi_buf.fdi.LastWriteTime, - *(FILETIME *) (void *) &fdi_buf.fdi.CreationTime, + fdi_buf.fdi.ChangeTime.QuadPart + ? &fdi_buf.fdi.ChangeTime : &fdi_buf.fdi.LastWriteTime, + &fdi_buf.fdi.LastAccessTime, + &fdi_buf.fdi.LastWriteTime, + &fdi_buf.fdi.CreationTime, pc.fs_serial_number (), fdi_buf.fdi.EndOfFile.QuadPart, fdi_buf.fdi.AllocationSize.QuadPart, @@ -458,10 +456,10 @@ too_bad: /* Arbitrary value: 2006-12-01 */ RtlSecondsSince1970ToTime (1164931200L, &ft); return fstat_helper (buf, - *(FILETIME *) (void *) &ft, - *(FILETIME *) (void *) &ft, - *(FILETIME *) (void *) &ft, - *(FILETIME *) (void *) &ft, + &ft, + &ft, + &ft, + &ft, 0, 0ULL, -1LL, @@ -506,7 +504,7 @@ fhandler_base::fstat_fs (struct __stat64 *buf) return res; } -/* The ftChangeTime is taken from the NTFS ChangeTime entry, if reading +/* The ChangeTime is taken from the NTFS ChangeTime entry, if reading the file information using NtQueryInformationFile succeeded. If not, it's faked using the LastWriteTime entry from GetFileInformationByHandle or FindFirstFile. We're deliberatly not using the creation time anymore @@ -518,10 +516,10 @@ fhandler_base::fstat_fs (struct __stat64 *buf) the latter might be old and not reflect the actual state of the file. */ int __stdcall fhandler_base::fstat_helper (struct __stat64 *buf, - FILETIME ftChangeTime, - FILETIME ftLastAccessTime, - FILETIME ftLastWriteTime, - FILETIME ftCreationTime, + PLARGE_INTEGER ChangeTime, + PLARGE_INTEGER LastAccessTime, + PLARGE_INTEGER LastWriteTime, + PLARGE_INTEGER CreationTime, DWORD dwVolumeSerialNumber, ULONGLONG nFileSize, LONGLONG nAllocSize, @@ -532,10 +530,10 @@ fhandler_base::fstat_helper (struct __stat64 *buf, IO_STATUS_BLOCK st; FILE_COMPRESSION_INFORMATION fci; - to_timestruc_t (&ftLastAccessTime, &buf->st_atim); - to_timestruc_t (&ftLastWriteTime, &buf->st_mtim); - to_timestruc_t (&ftChangeTime, &buf->st_ctim); - to_timestruc_t (&ftCreationTime, &buf->st_birthtim); + to_timestruc_t ((PFILETIME) LastAccessTime, &buf->st_atim); + to_timestruc_t ((PFILETIME) LastWriteTime, &buf->st_mtim); + to_timestruc_t ((PFILETIME) ChangeTime, &buf->st_ctim); + to_timestruc_t ((PFILETIME) CreationTime, &buf->st_birthtim); buf->st_dev = dwVolumeSerialNumber; buf->st_size = (_off64_t) nFileSize; /* The number of links to a directory includes the