[PATCH 1/5] Cygwin: gen_full_path_at: drop never reached code

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Jul 12 12:08:00 GMT 2023


From: Corinna Vinschen <corinna@vinschen.de>

The check if the local variable p is NULL is useless.  The preceeding
code always sets p to a valid pointer, or it crashes if path_ret is
invalid (which would be a bug in Cygwin).

Fixes:c57b57e5c43a ("* cygwin.din: Sort.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
---
 winsup/cygwin/syscalls.cc | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 73343ecc1f07..f0ef8955cee8 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -4447,11 +4447,6 @@ gen_full_path_at (char *path_ret, int dirfd, const char *pathname,
 	    }
 	  p = stpcpy (path_ret, cfd->get_name ());
 	}
-      if (!p)
-	{
-	  set_errno (ENOTDIR);
-	  return -1;
-	}
       if (pathname)
 	{
 	  if (!*pathname)
-- 
2.40.1



More information about the Cygwin-patches mailing list