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>
This commit is contained in:
Corinna Vinschen 2023-09-08 22:41:21 +02:00
parent bedefff9e2
commit c5913771a6
1 changed files with 4 additions and 1 deletions

View File

@ -1725,7 +1725,10 @@ int
fhandler_base::fchown (uid_t uid, gid_t gid) fhandler_base::fchown (uid_t uid, gid_t gid)
{ {
if (pc.is_fs_special ()) 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. */ /* By default, just succeeds. */
return 0; return 0;
} }