public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: fix an ugly cast
@ 2023-09-08 20:41 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-09-08 20:41 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c5913771a641ec54308ef5054837198be2a6fd63
commit c5913771a641ec54308ef5054837198be2a6fd63
Author: Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Fri Sep 8 22:41:21 2023 +0200
Commit: Corinna Vinschen <corinna@vinschen.de>
CommitDate: Fri Sep 8 22:41:21 2023 +0200
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>
Diff:
---
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 6163df2914d4..cdef01a2da67 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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-08 20:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08 20:41 [newlib-cygwin/main] Cygwin: fix an ugly cast Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).