[glibc] hurd: Fix looking up /dev/tty/ (BZ 34070)

Samuel Thibault via Glibc-cvs <[email protected]>
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=263efd544542c8fd991d8b483d69da5ca60b3181

commit 263efd544542c8fd991d8b483d69da5ca60b3181
Author: Samuel Thibault <[email protected]>
Date:   Wed Apr 15 00:39:16 2026 +0200

    hurd: Fix looking up /dev/tty/ (BZ 34070)
    
    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.

Diff:
---
 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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.