From 2f3126f6eca3a094336e0192fb09d0d75325ee0f Mon Sep 17 00:00:00 2001
From: Christopher Faylor <me@cgf.cx>
Date: Fri, 22 Mar 2002 04:27:52 +0000
Subject: [PATCH] * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper):
 Always set st_[ug]id to value derived from get_file_attributes.

---
 winsup/cygwin/ChangeLog             | 5 +++++
 winsup/cygwin/fhandler_disk_file.cc | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index a013038ef..d880a71ab 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-21  Christopher Faylor  <cgf@redhat.com>
+
+	* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always set
+	st_[ug]id to value derived from get_file_attributes.
+
 2002-03-21  Christopher Faylor  <cgf@redhat.com>
 
 	* spawn.cc (find_exec): Return input if file not found.
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index c251ed3cf..151b8ae42 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -281,9 +281,6 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf)
 
       if (!(buf->st_mode & S_IFMT))
 	buf->st_mode |= S_IFREG;
-
-      buf->st_uid = uid;
-      buf->st_gid = gid;
     }
   else
     {
@@ -338,6 +335,9 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf)
 	  }
     }
 
+  buf->st_uid = uid;
+  buf->st_gid = gid;
+
   syscall_printf ("0 = fstat (, %p) st_atime=%x st_size=%D, st_mode=%p, st_ino=%d, sizeof=%d",
 		 buf, buf->st_atime, buf->st_size, buf->st_mode,
 		 (int) buf->st_ino, sizeof (*buf));