diff options
-rw-r--r-- | src/make-prime-list.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/make-prime-list.c b/src/make-prime-list.c index 724924b40..b18b0e5f0 100644 --- a/src/make-prime-list.c +++ b/src/make-prime-list.c @@ -23,6 +23,8 @@ this program. If not, see http://www.gnu.org/licenses/. */ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <errno.h> +#undef fclose struct prime { @@ -166,5 +168,11 @@ main (int argc, char **argv) output_primes (prime_list, nprimes); + if (ferror (stdout) + fclose (stdout)) + { + fprintf (stderr, "write error: %s\n", strerror (errno)); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } |