From: Flavio Cruz Date: Tue, 12 Jan 2016 23:48:30 +0000 (+0100) Subject: Fix O_DIRECTORY lookup on trivial translators X-Git-Tag: glibc-2.23~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e42ce0f45ebf20b4c6f89da605cd62b1cd60a9df;p=thirdparty%2Fglibc.git Fix O_DIRECTORY lookup on trivial translators * hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Do not remove leading slash when `file_name' is "/". --- diff --git a/ChangeLog b/ChangeLog index 6322a675a34..025db2bbcee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-01-13 Flavio Cruz + + * hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Do not remove + leading slash when `file_name' is "/". + 2016-01-12 Joseph Myers * bits/mman-linux.h [!MCL_CURRENT] (MCL_ONFAULT): New macro. diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c index ef256acfb7d..aee2ba8f93f 100644 --- a/hurd/lookup-retry.c +++ b/hurd/lookup-retry.c @@ -62,8 +62,15 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) error_t lookup_op (file_t startdir) { - while (file_name[0] == '/') - file_name++; + if (file_name[0] == '/' && file_name[1] != '\0') + { + while (file_name[1] == '/') + /* Remove double leading slash. */ + file_name++; + if (file_name[1] != '\0') + /* Remove leading slash when we have more than the slash. */ + file_name++; + } return lookup_error ((*lookup) (startdir, file_name, flags, mode, &doretry, retryname, result));