replace: allow memmem() with an empty string to return NULL
[samba.git] / lib / replace / test / testsuite.c
index 829e9f9c1d7cf2ed63789b2b7f09d23f55265e92..46697b5f19d08fd31d623fce4fba20d2712713ed 100644 (file)
@@ -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;
        }