Subject: bug#11816: sort -o: error comes late if opening the outfile fails

From: Jim Meyering <[email-masked]>
Date: Mon, 02 Jul 2012 18:55:32 +0200

Pádraig Brady wrote:
>...
> diff --git a/tests/misc/sort-exit-early b/tests/misc/sort-exit-early
...
> +test $? == 124 && fail=1
> +
> +# Check all inputs are readable before starting to sort
> +# Also ensure the output isn't created in this case
> +touch output
> +chmod a-r output
> +timeout 10 sort -o typo - output && fail=1
> +test $? == 124 && fail=1

"make syntax-check" dinged these:

  tests/misc/sort-exit-early:24:test $? == 124 && fail=1
  tests/misc/sort-exit-early:31:test $? == 124 && fail=1
  maint.mk: use "test x = x", not "test x == x"
  make: *** [sc_prohibit_test_double_equal] Error 1

Here's a fix for a formatting nit in the sources:

   static void
  -check_inputs (char * const *files, size_t nfiles)
  +check_inputs (char *const *files, size_t nfiles)

Otherwise, it all looks fine.
Thanks again.