From c5913771a641ec54308ef5054837198be2a6fd63 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 8 Sep 2023 22:41:21 +0200 Subject: Cygwin: fix an ugly cast fhandler_base::fchown casts any fhandler landing here to a fhandler_disk_file. That's ugly and dangerous. Duplicate the path_conv info into an explicitly create fhandler_disk_file instead and call fchmod on that. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler/base.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler/base.cc b/winsup/cygwin/fhandler/base.cc index 6163df2..cdef01a 100644 --- a/winsup/cygwin/fhandler/base.cc +++ b/winsup/cygwin/fhandler/base.cc @@ -1725,7 +1725,10 @@ int fhandler_base::fchown (uid_t uid, gid_t gid) { if (pc.is_fs_special ()) - return ((fhandler_disk_file *) this)->fhandler_disk_file::fchown (uid, gid); + { + fhandler_disk_file fh (pc); + return fh.fchown (uid, gid); + } /* By default, just succeeds. */ return 0; } -- cgit v1.1