]> git.ipfire.org Git - thirdparty/coreutils.git/commit
maint: make-prime-list: do not ignore write failure
authorJim Meyering <meyering@redhat.com>
Sun, 23 Sep 2012 09:33:01 +0000 (11:33 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 4 Oct 2012 19:33:06 +0000 (21:33 +0200)
commitc6369e9004be56d427f0cc0d51d7009d727e061c
tree5ca3d017a780f9347299a444bc4653caa9326128
parentcf67e4cc9025ce921230b821cb7e75bce06876cd
maint: make-prime-list: do not ignore write failure

Even though this is just a helper program that is run solely to create
primes.h, it should not ignore a write failure.  Normally we would
simply call atexit (close_stdout), but we cannot do that from this
helper program, since it must be built before the generated header,
primes.h.  If we were to make the linking of make-prime-list depend
on libcoreutils.a, that would add all lib/*.o files to the list
of dependents of $(BUILT_HEADERS).  Then, since there is currently no
provision to ensure that a file like lib/stdio.h (another built header)
is built before the first lib/*.o file that also includes <stdio.h>,
some lib/*.o files would be built before lib/stdio.h and some after.
The former would provoke link failures due to undefined rpl_* functions.
* src/make-prime-list.c: Include <errno.h>.
(fclose): Undef, so that a definition to rpl_fclose does not
cause a link failure.
(main): Per the above, in this exceptional case, we check for fclose
and ferror failure manually, and don't worry about the ferror-only
failure case in which errno may not be relevant.
src/make-prime-list.c