summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-30 18:12:46 +1100
committerAndrew Tridgell <tridge@samba.org>2010-03-30 20:34:17 +1100
commit08e0d94faedc0793958183372f26f778f8ec8953 (patch)
tree87eeba1e9d625c43cbbb677741208179b796dc87
parentcc2ef27e369f0950ec931bf15cba4665c053ac53 (diff)
downloadsamba-08e0d94faedc0793958183372f26f778f8ec8953.tar.gz
samba-08e0d94faedc0793958183372f26f778f8ec8953.tar.bz2
samba-08e0d94faedc0793958183372f26f778f8ec8953.zip
replace: allow memmem() with an empty string to return NULL
This is how FreeBSD behaves. We don't rely on it returning the string in Samba.
-rw-r--r--lib/replace/test/testsuite.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/replace/test/testsuite.c b/lib/replace/test/testsuite.c
index 829e9f9c1d..46697b5f19 100644
--- a/lib/replace/test/testsuite.c
+++ b/lib/replace/test/testsuite.c
@@ -1027,7 +1027,9 @@ static int test_memmem(void)
}
s = memmem("foo", 3, "", 0);
- if (strcmp(s, "foo") != 0) {
+ /* it is allowable for this to return NULL (as happens on
+ FreeBSD) */
+ if (s && strcmp(s, "foo") != 0) {
printf(__location__ ": Failed memmem\n");
return false;
}