Re: [PATCH 2/2] Cygwin: path_conv::check: handle error from fhandler_process::exists

2020-09-08 Thread Ken Brown via Cygwin-patches

On 9/8/2020 12:50 PM, Ken Brown via Cygwin-patches wrote:

fhandler_process::exists is called when we are checking a path
starting with "/proc//fd".  If it returns virt_none and sets an
errno, there is no need for further checking.  Just set 'error' and
return.
---
  winsup/cygwin/path.cc | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 95faf8ca7..092261939 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -809,6 +809,12 @@ path_conv::check (const char *src, unsigned opt,
  delete fh;
  goto retry_fs_via_processfd;
}
+ else if (file_type == virt_none && dev == FH_PROCESSFD)
+   {
+ error = get_errno ();
+ if (error)
+   return;
+   }
  delete fh;
}
  switch (file_type)



There's a missing 'delete fh' above.  I'll send v2 shortly.

Ken


[PATCH 2/2] Cygwin: path_conv::check: handle error from fhandler_process::exists

2020-09-08 Thread Ken Brown via Cygwin-patches
fhandler_process::exists is called when we are checking a path
starting with "/proc//fd".  If it returns virt_none and sets an
errno, there is no need for further checking.  Just set 'error' and
return.
---
 winsup/cygwin/path.cc | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 95faf8ca7..092261939 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -809,6 +809,12 @@ path_conv::check (const char *src, unsigned opt,
  delete fh;
  goto retry_fs_via_processfd;
}
+ else if (file_type == virt_none && dev == FH_PROCESSFD)
+   {
+ error = get_errno ();
+ if (error)
+   return;
+   }
  delete fh;
}
  switch (file_type)
-- 
2.28.0