diff --git a/src/laws.test.c b/src/laws.test.c index 987b27773..58cba3942 100644 --- a/src/laws.test.c +++ b/src/laws.test.c @@ -700,7 +700,7 @@ static void statistic_test(CuTest *tc, int peasants, int luck, int maxp, for (i = 0; i < 1000; ++i) { effect = peasant_luck_effect(peasants, luck, maxp, variance); CuAssertTrue(tc, min_value <= effect); -// broken CuAssertTrue(tc, max_value >= effect); + CuAssertTrue(tc, max_value >= effect); } } diff --git a/src/util/bsdstring.c b/src/util/bsdstring.c index c43847da1..4205b9480 100644 --- a/src/util/bsdstring.c +++ b/src/util/bsdstring.c @@ -12,10 +12,6 @@ int wrptr(char **ptr, size_t * size, size_t bytes) if (bytes == 0) { return 0; } - if (bytes < 0) { - *size = 0; - return EINVAL; - } if (bytes <= *size) { *ptr += bytes; *size -= bytes; @@ -24,7 +20,7 @@ int wrptr(char **ptr, size_t * size, size_t bytes) *ptr += *size; *size = 0; - return ENAMETOOLONG; + return ERANGE; } #ifndef HAVE_STRLCPY