From: Bruno Haible Date: Sat, 29 Feb 2020 21:33:04 +0000 (+0100) Subject: tests: fix test failure on FreeBSD 12 X-Git-Tag: v8.32~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54bf2c2f1a9f822c724476f30888e0a4299c1359;p=thirdparty%2Fcoreutils.git tests: fix test failure on FreeBSD 12 * tests/misc/csplit-io-err.sh: Limit the effect of the fwrite override to streams != stderr, as fwrite is in the error() path there. --- diff --git a/tests/misc/csplit-io-err.sh b/tests/misc/csplit-io-err.sh index 683a9e4f8f..f1e6229010 100755 --- a/tests/misc/csplit-io-err.sh +++ b/tests/misc/csplit-io-err.sh @@ -39,9 +39,23 @@ cat > k.c <<'EOF' || framework_failure_ size_t fwrite (const void *ptr, size_t size, size_t nitems, FILE *stream) { - fclose (fopen ("preloaded","w")); /* marker for preloaded interception */ - errno = ENOSPC; - return 0; + if (stream == stderr) + { + /* Perform the normal operation of fwrite. */ + const char *p = ptr; + size_t count = size * nitems; + size_t i; + for (i = 0; i < count; i++) + if (putc ((unsigned char) *p++, stream) == EOF) + break; + return i / size; + } + else + { + fclose (fopen ("preloaded","w")); /* marker for preloaded interception */ + errno = ENOSPC; + return 0; + } } size_t