From 08e0d94faedc0793958183372f26f778f8ec8953 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 30 Mar 2010 18:12:46 +1100 Subject: 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. --- lib/replace/test/testsuite.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/replace/test/testsuite.c') 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; } -- cgit