Update.
authorUlrich Drepper <drepper@redhat.com>
Thu, 4 Apr 2002 08:12:33 +0000 (08:12 +0000)
committerUlrich Drepper <drepper@redhat.com>
Thu, 4 Apr 2002 08:12:33 +0000 (08:12 +0000)
2002-04-04  Ulrich Drepper  <drepper@redhat.com>

* misc/dirname.c (dirname): Ignore trailing slashes at end of
non-null result [PR libc/2600].

* misc/tst-dirname.c: Add more tests.

ChangeLog
misc/dirname.c
misc/tst-dirname.c

index 0644cec..252a5cd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-04-04  Ulrich Drepper  <drepper@redhat.com>
+
+       * misc/dirname.c (dirname): Ignore trailing slashes at end of
+       non-null result [PR libc/2600].
+
+       * misc/tst-dirname.c: Add more tests.
+
 2002-04-03  Ulrich Drepper  <drepper@redhat.com>
 
        * locale/programs/charmap.c (charmap_read): If the charmap doesn't
index b1a0e0c..94ab1c0 100644 (file)
@@ -1,5 +1,5 @@
 /* dirname - return directory part of PATH.
-   Copyright (C) 1996, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -66,6 +66,8 @@ dirname (char *path)
          else
            last_slash = path + 1;
        }
+      else
+       last_slash = runp;
 
       last_slash[0] = '\0';
     }
index 0808b83..a428786 100644 (file)
@@ -1,5 +1,5 @@
 /* Test program for dirname function a la XPG.
-   Copyright (C) 1996, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -62,5 +62,9 @@ main (void)
   result |= test ("//usr//", "//");
   result |= test ("//", "//");
 
+  /* Other Unix implementations behave like this.  */
+  result |= test ("x///y", "x");
+  result |= test ("x/////y", "x");
+
   return result != 0;
 }