diff --git a/src/lib/common/stmtch.c b/src/lib/common/stmtch.c index 0f018713..b2343292 100644 --- a/src/lib/common/stmtch.c +++ b/src/lib/common/stmtch.c @@ -56,9 +56,10 @@ stmtch(char *needle, void *haystack, ptrdiff_t offs, size_t elt_size) case ME_MISMATCH: break; case ME_PARTIAL: - if (res >= 0) - return M_NOTUNIQUE; - res = i; + if (res == M_NOTFOUND) + res = i; + else + res = M_NOTUNIQUE; break; case ME_EXACT: return i;