diff options
author | Jim Meyering <jim@meyering.net> | 2000-07-23 09:25:14 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-07-23 09:25:14 +0000 |
commit | 2546495dab90deab019c7f91e89355ebef777ca3 (patch) | |
tree | e8ccf31703db550a0701177366420863dbd156a7 | |
parent | dbca6b183be459f301af606393f5157d2bfce76f (diff) | |
download | coreutils-2546495dab90deab019c7f91e89355ebef777ca3.tar.xz |
(base_name): Add an assertion.
-rw-r--r-- | lib/basename.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/basename.c b/lib/basename.c index be03e609b..5237b11b7 100644 --- a/lib/basename.c +++ b/lib/basename.c @@ -19,6 +19,8 @@ # include <config.h> #endif +#include <assert.h> + #ifndef FILESYSTEM_PREFIX_LEN # define FILESYSTEM_PREFIX_LEN(Filename) 0 #endif @@ -61,5 +63,8 @@ base_name (char const *name) if (*base == '\0' && ISSLASH (*name) && all_slashes) --base; + /* Make sure the last byte is not a slash. */ + assert (all_slashes || *(p - 1) != '/'); + return (char *) base; } |