Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-09-08 23:41:21 +0300
committerCorinna Vinschen <corinna@vinschen.de>2023-09-08 23:41:21 +0300
commitc5913771a641ec54308ef5054837198be2a6fd63 (patch)
tree46c2cd2d02a580d86da53537e31bbe0e623f4d61 /winsup
parentbedefff9e25b6b2bdc13e0268a437f82dc4b4798 (diff)
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 <corinna@vinschen.de>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/fhandler/base.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler/base.cc b/winsup/cygwin/fhandler/base.cc
index 6163df291..cdef01a2d 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;
}