]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - hurd/hurdlookup.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / hurd / hurdlookup.c
index c1f6ad7c6674b49c351704ca38bdea5ef03d65d7..d410af1a49cd0fb4eb7fc64af575076703cc6fcd 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,93,94,95,96,97,99,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2015 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
@@ -12,9 +12,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <hurd.h>
 #include <hurd/lookup.h>
@@ -141,6 +140,8 @@ __hurd_file_name_split (error_t (*use_init_port)
                                     dirname, 0, 0, dir);
        }
     }
+  else if (file_name[0] == '\0')
+    return ENOENT;
   else
     {
       /* "foobar" => cwdir + "foobar".  */
@@ -181,19 +182,7 @@ __hurd_directory_name_split (error_t (*use_init_port)
        --lastslash;
 
       /* Find the last one earlier in the string, before the trailing ones.  */
-#if __GLIBC__ > 2 || __GLIBC_MINOR__ >= 2
       lastslash = __memrchr (file_name, '/', lastslash - file_name);
-#else
-      /* Keep backing up, looking for a slash.  */
-      do
-       if (lastslash == file_name)
-         {
-           /* Hit the start with no slash.  */
-           lastslash = NULL;
-           break;
-         }
-      while (*lastslash-- != '/');
-#endif
     }
 
   if (lastslash != NULL)
@@ -216,6 +205,8 @@ __hurd_directory_name_split (error_t (*use_init_port)
                                     dirname, 0, 0, dir);
        }
     }
+  else if (file_name[0] == '\0')
+    return ENOENT;
   else
     {
       /* "foobar" => cwdir + "foobar".  */