Run 'make update-copyright'.
* lib/regexprops.c (copying): Update the year number manually.
* All other files: Update copyright years via the above make run.
Run 'make update-copyright'.
* lib/regexprops.c (copying): Update the year number manually.
* All other files: Update copyright years via the above make run.
die() has the advantage of being apparent to the compiler
that it doesn't return, which will avoid warnings in some cases,
and possibly generate better code.
While at it, wrap some of the overly long error messages into a new line.
* cfg.mk (sc_die_EXIT_FAILURE): A new syntax check rule to
catch any new uses of error (CONSTANT, ...);
* find/exec.c: Include "die.h" and use die rather than exit (EXIT_FAILURE).
* find/fstype.c: Likewise.
* find/ftsfind.c: Likewise.
* find/oldfind.c: Likewise.
* find/parser.c: Likewise.
* find/pred.c: Likewise.
* find/print.c: Likewise.
* find/tree.c: Likewise.
* find/util.c: Likewise.
* lib/buildcmd.c: Likewise.
* lib/listfile.c: Likewise.
* lib/regextype.c: Likewise.
* lib/safe-atoi.c: Likewise.
* locate/frcode.c: Likewise.
* locate/locate.c: Likewise.
* locate/word_io.c: Likewise.
* xargs/xargs.c: Likewise.
* lib/regexprops.c (copying): Update the text so that the
copyright years (and the line breaks) match the
result of "make update-copyright".
* doc/regexprops.texi: Tweak copyright years to match the
result of "make update-copyright".
* All other files: update copyright years if the file has
a copyright statement.
* .x-update-copyright: new file, a list of files to exclude
from automated copyright updates.
* find/util.c (check_nofollow): Avoid compiler warnings about
comparison between the float variable release and some double
constants by changing the constants to be floats, too.
* find/parser.c (estimate_file_age_success_rate): Avoid warnings
of comparison of float against other types by consistently using
float constants.
(insert_type): move the definition of type_cell and set it in the
switch cases handling S_IFLINK and other types of file which may
not be defined on the platform we're building for. We do this in
order to silence a compiler warning about use of an uninitialised
value. It's not really used uninitialised, it's just that the
compiler doesn't know that the way we're calling error() will
cause that function not to return.
(parse_time): Avoid a compiler warning about signed/unsigned
comparison by using a cast.
* find/ftsfind.c: Don't #define USE_SAFE_CHDIR, it's unused.
Likewise STRINGIFY.
(show_outstanding_execdirs): Avoid overflowing int variable seen
by making a bool and setting it to true, instead of incrementing
it.
(main): Correct the call to ctime; it takes time_t*, so don't pass
struct timeval* (instead, pass the address of the tv_sec member).
* find/exec.c (launch): Avoid warnign of unused parameter ctl. We
really don't use it, but this function takes the parameter as
it's a callback.
* find/pred.c (struct pred_assoc): make the pred_name member const.
* find/defs.h: Declare pred_quit as _GL_ATTRIBUTE_NORETURN.
* find/find.c (get_current_dirfd): remove unused function.
(process_dir): make parameters const: parent, pathname, name.
(process_path): make parameters const: parent, pathname, name.
(at_top): Modify the function pointer parameter accordingly.
* find/ftsfind.c (get_fts_info_name): Now returns const char*, not
char*.
(show_outstanding_execdirs): Fix type of loop variable to avoid
possible overflow.
(process_all_startpoints): Avoid compiler warning about overflow
of int loop variable.
* find/defs.h (struct predicate): Make p_name const.
(struct state): make rel_pathname const.
* find/exec.c (impl_pred_exec): Make prefix const.
(launch): Silence compiler warning about unused parameter argc.
* find/pred.c (blank_rtrim): Make str parameter const, since we do
not modify it.
* find/util.c (debug_option_assoc): name and docstring are now
const qualified.
(show_valid_debug_options): Avoid signed/unsigned comparison by
using a size_t array index.
(set_stat_placeholders): Avoid a compiler warning on systems
lacking birth time fields (and on which this function therefore
does nothing).
Before this change, a pointer to struct saved_cwd was used in place
of char*, leading to incorrect error diagnostics, e.g.:
$ chmod a-x . && find / -maxdepth 0 -exec true \;
find: Failed to change directory: ÿÿÿÿ: Permission denied
find: failed to restore initial working directory: ÿÿÿÿ: Permission denied
* find/exec.c (prep_child_for_exec): Fix error diagnostics.
* find/util.c (record_initial_cwd, cleanup_initial_cwd): Likewise.
* find/exec.c (prep_child_for_exec): When issuing an error message
about a failure to change directory, mention the directory.
* find/util.c (record_initial_cwd): Do the same when saving the
initial working directory.
(cleanup_initial_cwd): Also when restoring the initial working
directory.
* find/exec.c (initialise_wd_for_exec): rename to
initialize_wd_for_exec, since "initialize" is the preferred form
even in UK spelling (the OED says "initialise" is a variant).
Update callers (it's a static function). Update spelling in
comments.
* find/find.c (main): Fix missing "to" in error message and update
"initialise" to "initialize". Update comment too.
* find/ftsfind.c (main): Update spelling in error message.
* lib/listfile.c (print_name_with_quoting): spelling change in
comment.
* find/tree.c (init_pred_perf): Likewise.
* lib/extendbuf.c (extendbuf): Likewise.
* lib/splitstring.h: Likewise.
* find/print.c (format_date): Likewise.
* doc/find-maint.texi (Tools): Update spelling.
Prevent "Failed to save working dir[...]: Too many open files"
error by closing the file descriptor of the working directory.
* find/exec.c (impl_pred_exec): Free the working directory if find
executes the command in the local dir, i.e. if it has been saved
by record_exec_dir(). Re-indent code.
* find/testsuite/sv-34976-execdir-fd-leak.sh: Add test.
* find/testsuite/Makefile.am (test_shell_progs): Mention the test.
* NEWS: Mention the fix.
* find/exec.c (impl_pred_exec): Once pushing an argument for
-exec{,dir} ... +, Only set state.execdirs_outstanding if
there were previously no todo items on ths command line.
This avoids spurious calls to complete_pending_execdirs().
* locate/locate.c: Include <regex.h> instead of "regex.h".
Include "fnmatch.h" instead of <fnmatch.h> (because we use
fnmatch-gnu). Include "gettext.h".
* lib/regexprops.c: Include <regex.h> instead of "regex.h".
* find/tree.c: Include "gettext.h". Include "fnmatch.h" instead
of <fnmatch.h> (because we use fnmatch-gnu).
* find/parser.c: Include "gettext.h" and <regex.h>. Include
"fnmatch.h" instead of <fnmatch.h> (because we use fnmatch-gnu).
* find/pred.c: Likewise.
* find/exec.c: Include "gettext.h".
* find/find.c: Likewise.
* find/fstype.c: Likewise.
* find/ftsfind.c: Likewise.
* find/print.c: Likewise.
* lib/buildcmd.c: Likewise.
* lib/fdleak.c: Likewise.
* lib/findutils-version.c: Likewise.
* lib/regextype.c: Likewise.
* lib/safe-atoi.c: Likewise.
* find/util.c: Likewise.
* locate/bigram.c: Likewise.
* locate/code.c: Likewise.
* locate/frcode.c: Likewise.
* locate/word_io.c: Likewise.
* xargs/xargs.c: Likewise.
* find/Makefile.am: Add a comment explaining why gnulib-tool
advised us to use each library.
* find/ftsfind.c (show_outstanding_execdirs): Now that
execp->state.cmd_argc is a size_t, we can't print it with %d. So
print it with PRIuMAX (and include <inttypes.h> to define that).
* find/tree.c (prec_name): change return type to const char*.
(type_name): Likewise.
* find/exec.c (impl_pred_exec): use a separate variable (buf) to
point the memory allocated/freed with malloc/free, so that the
existing variable target can then be const (and so we can assign
pathname to it without a compiler warning).
* find/find.c: Since gnulib defines O_NOFOLLOW, don't check to see
if the macro is defined. Check instead to see if it is 0.
(safely_chdir_nofollow): Point this out.
(safely_chdir): Check O_NOFOLLOW for zeroness.
* find/exec.c: Don't #define SIGCHLD.
* xargs/xargs.c: Likewise.
* find/exec.c: New file.
(initialise_wd_for_exec): Move out of pred.c
(record_exec_dir): Likewise.
(impl_pred_exec): Likewise.
(prep_child_for_exec): Likewise.
(launch): Likewise.
* find/pred.c: These functions are moved out of this file.
* find/defs.h: impl_pred_exec is no longer static in pred.c, do
add an external declaration for it. Move the declaration of
launch to here also.
* find/Makefile.am (libfindtools_a_SOURCES): Add exec.c.
* po/POTFILES.in: Add find/exec.c.
Signed-off-by: James Youngman <jay@gnu.org>