Files
findutils/lib/Makefile.am
James Youngman 6c6a72bb00 Fix file descriptor leaks.
* import-gnulib.config (gnulib_version): Update to more recent
version of gnulib.  Import the cloexec module too.
* lib/fdleak.c: New file; a module for detecting file descriptor
leaks.   Also define an open_cloexec() function.
* lib/fdleak.h: Declare the global functions defined in fdleak.c.
* lib/Makefile.am (libfind_a_SOURCES): Add fdleak.c and fdleak.h.
* find/find.c (main): Call remember_non_cloexec_fds in order to
detect file descriptor leaks.
(main): set FD_CLOEXEC on starting_desc.
(safely_chdir_lstat): Likewise for dotfd.
(safely_chdir_nofollow): Likewise for fd.
* find/ftsfind.c (inside_dir): set FD_CLOEXEC on curr_fd.
(main): Call remember_non_cloexec_fds in order to detect file
descriptor leaks.
(main): set FD_CLOEXEC on starting_desc.
* find/pred.c (launch): before we exec the child, call
complain_about_leaky_fds in order to complain about non-FD_CLOEXEC
file descriptors that weren't open when the program was run.
* find/sharefile.c (sharefile_fopen): Set FD_CLOEXEC on the files
we open.
* gnulib-local/lib/save-cwd.c.diff: Patch gnulib to set FD_CLOEXEC
on the file descriptors opened by save_cwd.
* gnulib-local/modules/save-cwd.diff: Hence the save-cwd module
depends on the cloexec module.
* import-gnulib.sh (run_gnulib_tool): Pass the --local-dir option
in order to apply these patches.

Signed-off-by: James Youngman <jay@gnu.org>
2010-03-30 00:51:00 +01:00

53 lines
1.5 KiB
Makefile

## Process this file with automake to produce Makefile.in.
AUTOMAKE_OPTIONS = 1.5 gnits
# no-dependencies
AM_CFLAGS = $(WARN_CFLAGS)
noinst_LIBRARIES = libfind.a
check_PROGRAMS = regexprops
check_SCRIPTS = check-regexprops
regexprops_SOURCES = regexprops.c regextype.c
TESTS =
if CROSS_COMPILING
# The regexprops program needs to be a native executable, so we
# can't build it with a cross-compiler.
else
TESTS += check-regexprops
endif
libfind_a_SOURCES = gnulib-version.c findutils-version.c
EXTRA_DIST = modetype.h extendbuf.h savedirinfo.h buildcmd.h \
gnulib-version.h gnulib-version.c findutils-version.h \
fdleak.h check-regexprops.sh
BUILT_SOURCES = gnulib-version.c
SUFFIXES =
MOSTLYCLEANFILES =
CLEANFILES = check-regexprops
DISTCLEANFILES =
MAINTAINERCLEANFILES =
INCLUDES = -I../gnulib/lib -I$(top_srcdir)/gnulib/lib
LDADD = ../gnulib/lib/libgnulib.a $(LIBINTL)
libfind_a_SOURCES += modetype.h nextelem.h printquoted.h listfile.h \
regextype.h dircallback.h
libfind_a_SOURCES += listfile.c nextelem.c extendbuf.c buildcmd.c savedirinfo.c \
forcefindlib.c qmark.c printquoted.c regextype.c dircallback.c fdleak.c
EXTRA_DIST += waitpid.c forcefindlib.c
TESTS_ENVIRONMENT = REGEXPROPS=regexprops$(EXEEXT)
libfind_a_LIBADD = @FINDLIBOBJS@
libfind_a_DEPENDENCIES = @FINDLIBOBJS@
# libfind_la_LIBADD = @LTFINDLIBOBJS@
# libfind_a_OBJECTS += @FINDLIBOBJS@
# libfind_la_OBJECTS += @LTFINDLIBOBJS@
check-regexprops: check-regexprops.sh
cp $(srcdir)/check-regexprops.sh check-regexprops
chmod +x check-regexprops