We need to keep the heading / to properly get an ENOTDIR, and set
file_name rather than change the retryname content.

Also, *result is normally used for the startdir.
---
 hurd/lookup-retry.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c
index 94ff0e3222..2a5ea16cba 100644
--- a/hurd/lookup-retry.c
+++ b/hurd/lookup-retry.c
@@ -323,9 +323,12 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
                    err = opentty (result);
                    goto out;
                  case '/':
-                   if (err = opentty (&startdir))
+                   if (*result != MACH_PORT_NULL)
+                     __mach_port_deallocate (__mach_task_self (), *result);
+                   if (err = opentty (result))
                      goto out;
-                   memmove (retryname, &retryname[4], strlen(retryname + 4) + 
1);
+                   startdir = *result;
+                   file_name = &retryname[3];
                    break;
                  default:
                    goto bad_magic;
-- 
2.53.0


Reply via email to