]> git.ipfire.org Git - pakfire.git/commitdiff
tests: Only negative return values are considered unsuccessful
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 25 Mar 2025 11:26:15 +0000 (11:26 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 25 Mar 2025 11:26:15 +0000 (11:26 +0000)
Sometimes we want to return the length of consumed input, so this should
all be considered successful.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/testsuite.h

index d9a0ae7b87b8a405672574af52fffdd72ed14e47..648bc8c0cb6b007b5588d9ff58f7af16ca60764b 100644 (file)
@@ -141,7 +141,7 @@ ERROR:
 #define ASSERT_SUCCESS(expr) \
        do { \
                int __r = expr; \
-               if (__r) { \
+               if (__r < 0) { \
                        LOG_ERROR("Failed assertion: %s (r = %d - %s, errno = %s) at %s:%d %s\n", \
                                #expr, __r, (__r < 0) ? strerror(-__r) : "UNKNOWN", strerror(errno), __FILE__, __LINE__, __PRETTY_FUNCTION__); \
                        goto FAIL; \