[PATCH] Cygwin: disk_file: Add error handling to fhandler_base::fstat_helper
Takashi Yano
takashi.yano@nifty.ne.jp
Sun Dec 8 07:43:51 GMT 2024
Previous fhandler_base::fstat_helper() does not assume get_stat_handle()
returns NULL. Due to this, access() for network share which has not been
authenticated returns 0 (success). This patch add error handling to
fhandler_base::fstat_helper() for get_stat_handle() failure.
Fixed: 5a0d1edba4b3 ("(fhandler_base::fstat_helper): Use handle returned by get_stat_handle.")
Reviewed-by:
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
---
winsup/cygwin/fhandler/disk_file.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/winsup/cygwin/fhandler/disk_file.cc b/winsup/cygwin/fhandler/disk_file.cc
index 2008fb61b..7c3c805fd 100644
--- a/winsup/cygwin/fhandler/disk_file.cc
+++ b/winsup/cygwin/fhandler/disk_file.cc
@@ -400,6 +400,11 @@ fhandler_base::fstat_helper (struct stat *buf)
IO_STATUS_BLOCK st;
FILE_COMPRESSION_INFORMATION fci;
HANDLE h = get_stat_handle ();
+ if (h == NULL)
+ {
+ __seterrno ();
+ return -1;
+ }
PFILE_ALL_INFORMATION pfai = pc.fai ();
ULONG attributes = pc.file_attributes ();
--
2.45.1
More information about the Cygwin-patches
mailing list