summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-01-25 12:30:01 +0000
committerJim Meyering <jim@meyering.net>2005-01-25 12:30:01 +0000
commitaabf87bc83233c6858a2b2d2b07902ded2ed33be (patch)
treee416e215d1c8113d9411ea2124a6e24068d56d52
parent313147e76a16a619f80704d008217da2d0160535 (diff)
downloadcoreutils-aabf87bc83233c6858a2b2d2b07902ded2ed33be.tar.xz
Don't include assert.h.
(path_concat): Remove assertion that would have triggered for ABASE starting with more than one slash. Reported by Andreas Schwab.
-rw-r--r--lib/path-concat.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/path-concat.c b/lib/path-concat.c
index 06b040e76..6e4092278 100644
--- a/lib/path-concat.c
+++ b/lib/path-concat.c
@@ -22,7 +22,6 @@
#if HAVE_CONFIG_H
# include <config.h>
#endif
-# include <assert.h>
/* Specification. */
#include "path-concat.h"
@@ -56,7 +55,9 @@ longest_relative_suffix (char const *f)
in the result, removing any redundant separators.
In any case, if BASE_IN_RESULT is non-NULL, set
*BASE_IN_RESULT to point to the copy of ABASE in the returned
- concatenation.
+ concatenation. However, if ABASE begins with more than one slash,
+ set *BASE_IN_RESULT to point to the sole corresponding slash that
+ is copied into the result buffer.
Report an error if memory is exhausted. */
@@ -84,9 +85,6 @@ path_concat (char const *dir, char const *abase, char **base_in_result)
p = mempcpy (p, base, baselen);
*p = '\0';
- assert (!base_in_result
- || strcmp (*base_in_result, abase) == 0);
-
return p_concat;
}
@@ -108,6 +106,7 @@ main ()
{"/", "/", "/"},
{"a", "/", "a/"}, /* this might deserve a diagnostic */
{"/a", "/", "/a/"}, /* this might deserve a diagnostic */
+ {"a", "//b", "a/b"},
};
size_t i;
bool fail = false;