Commit Graph

6 Commits

Author SHA1 Message Date
Filipe Brandenburger
b56fd9d358 build-sys: split test cases in lib/ into their own files
In order to avoid compiling the same source files twice, with and
without the TEST_PROGRAM define.

Tested that the build still works and that `make distcheck` works as
expected.

Tested that the test_* programs in lib/ keep working. (Though they are
not really invoked by `make check` and in particular test_nsutils is
quite useless, test_fileutils also quite poor.)

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2015-05-01 17:43:51 -07:00
Jim Warner
ce5e995921 library: for atexit() support, fix fileutils for EPIPE
When fileutils with stream error checking was borrowed
from GNU lib, an omission was also propagated where an
errno of EPIPE wouldn't be preserved in close_stream()
making a test for EPIPE in close_stdout() meaningless.

This patch corrects such oversight so that an errno of
EPIPE no longer produces 'write error' at program end.

( gnulib provides for optionally ignoring EPIPE, but )
( if a program chooses to ignore it, then their code )
( appears to suffer from this close_stream oversight )

Reference(s):
. original fileutilis addition
commit c7cf98b0e0
. bugzilla report
https://bugzilla.redhat.com/show_bug.cgi?id=976199
2013-06-26 17:58:56 +02:00
Rainer Müller
838e5d8941 configure: Check for error.h
For portability, check for error.h during configure and define
HAVE_ERROR_H accordingly.

If this header is not available, emulate the functionality of error()
from glibc with an inline wrapper in include/c.h.
2013-03-20 16:32:06 +01:00
Rainer Müller
6df4fc403d configure: Check for stdio_ext.h
For portability, check for stdio_ext.h during configure and define
HAVE_STDIO_EXT_H accordingly.

If the current system does not provide this header, use a fallback for
__fpending(). This definition will not work on all systems as it relies
on internal data structures of libc. A more portable solution should be
preferred, for example by using gnulib.
2013-03-20 16:32:06 +01:00
Sami Kerola
9e3c259fae lib/fileutils: fix compiler warnings
./lib/fileutils.c:9:5: warning: no previous declaration for 'close_stream' [-Wmissing-declarations]
./lib/fileutils.c:23:6: warning: no previous declaration for 'close_stdout' [-Wmissing-declarations]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-06 22:28:30 +11:00
Sami Kerola
c7cf98b0e0 lib: add fileutils file with stream error checking facility
The close_stream() is copied from GNU lib. Inspiration to do this
is talk by Jim Meyering - Goodbye World! The perils of relying on
output streams in C.

Reference: http://www.irill.org/events/ghm-gnu-hackers-meeting/videos/jim-meyering-goodbye-world-the-perils-of-relying-on-output-streams-in-c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-23 15:57:41 +01:00