]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - hurd/lookup-retry.c
Fix BZ #21654 - grp-merge.c alignment
[thirdparty/glibc.git] / hurd / lookup-retry.c
index ef256acfb7db37a6df90934b9773672f732f1511..2d88b98e4f02d4588508e9195fd5157a56cc3cc2 100644 (file)
@@ -1,5 +1,5 @@
 /* hairy bits of Hurd file name lookup
-   Copyright (C) 1992-2016 Free Software Foundation, Inc.
+   Copyright (C) 1992-2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -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));