On 11/11/15 15:18, Assaf Gordon wrote:
> 
> Attached an improved test, this time using '/dev/full' (if exists) to get the 
> wording for the ENOSPC errno, then verify the error message from csplit.

heh nice.
comments below...

> diff --git a/tests/misc/csplit-io-err.sh b/tests/misc/csplit-io-err.sh

> +# Replace fwrite and ferror, always returning an error
> +cat > k.c <<'EOF' || framework_failure_
> +#include <stdio.h>
> +#include <errno.h>
> +
> +#undef fwrite
> +#undef fwrite_unlocked
> +
> +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;
> +}
> +
> +size_t
> +fwrite_unlocked (const void *ptr, size_t size, size_t nitems, FILE *stream)
> +{
> +  fclose (fopen ("preloaded","w")); /* marker for preloaded interception */
> +  errno = ENOSPC;
> +  return 0;

Maybe replace the above 3 lines with:

     return fwrite (ptr, size, nitems, stream);

> +# Create the expected error message
> +( printf "%s" "csplit: write error for 'xx01': " ; cat msg ) > exp \
> +  || framework_failure_

It's better to use { cmd; } than ( cmd ) here
as some shell will avoid a subshell in that case.

please push after those tweaks.

thanks!
Pádraig

Reply via email to