From f27542af5b43ae866bb533787dde6206c47a9eb0 Mon Sep 17 00:00:00 2001 From: Trevor Pounds Date: Tue, 2 Feb 2010 21:35:25 -0600 Subject: [PATCH] (SIGAR-202) Change CreateFile() access flags to prevent potential inode calculation errors on Windows when tailing a file. see: http://forums.hyperic.com/jiveforums/thread.jspa?messageID=30400 --- src/sigar_fileinfo.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sigar_fileinfo.c b/src/sigar_fileinfo.c index aae049dc..b8d4afef 100644 --- a/src/sigar_fileinfo.c +++ b/src/sigar_fileinfo.c @@ -381,9 +381,14 @@ static int fileattrs_get(sigar_t *sigar, FILE_FLAG_BACKUP_SEMANTICS : FILE_ATTRIBUTE_NORMAL; + /** + * We need to set dwDesiredAccess to 0 to work in cases where GENERIC_READ can fail. + * + * see: http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx + */ handle = CreateFile(file, - GENERIC_READ, - FILE_SHARE_READ, + 0, + 0, NULL, OPEN_EXISTING, flags,