From a7b6e16281c45aa91395a8dcdaa623d6bce69bab Mon Sep 17 00:00:00 2001 From: joeyh Date: Wed, 28 Nov 2007 19:19:39 +0000 Subject: [PATCH] * isutf8: Correct inverted exit code when passed a file to check. Closes: #453306 --- check-isutf8 | 11 +++++++++++ debian/changelog | 7 +++++++ isutf8.c | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/check-isutf8 b/check-isutf8 index d2858d9..3abb315 100755 --- a/check-isutf8 +++ b/check-isutf8 @@ -17,6 +17,17 @@ check() { echo " got: $ret" failed=1 fi + printf "$2" > check-isutf8.tmp.$$ + ./isutf8 -q check-isutf8.tmp.$$ + ret=$? + rm -f check-isutf8.tmp.$$ + if [ $ret != $1 ]; then + echo "Failure (from file):" + echo " input: $2" + echo " expected: $1" + echo " got: $ret" + failed=1 + fi } check 0 '' diff --git a/debian/changelog b/debian/changelog index 5fc0d0b..1e93cc3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +moreutils (0.26) UNRELEASED; urgency=low + + * isutf8: Correct inverted exit code when passed a file to check. + Closes: #453306 + + -- Joey Hess Wed, 28 Nov 2007 14:16:44 -0500 + moreutils (0.25) unstable; urgency=low * isutf8: Detect and reject overlong UTF-8 sequences. Closes: #440951 diff --git a/isutf8.c b/isutf8.c index 9af7d70..4306c7d 100644 --- a/isutf8.c +++ b/isutf8.c @@ -258,7 +258,7 @@ int main(int argc, char **argv) { strerror(errno)); ok = 0; } else { - if (is_utf8_byte_stream(file, argv[i], quiet)) + if (! is_utf8_byte_stream(file, argv[i], quiet)) ok = 0; (void) fclose(file); } -- 2.39.5