diff --git a/ChangeLog b/ChangeLog index b608a66e..8e40f99f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2013-03-24 James Youngman + Fix Savannah bug #38583: errno-buffer read failed in xargs_do_exec + * import-gnulib.config (modules): Import the safe-read module. + * xargs/xargs.c (xargs_do_exec): Use safe_read so that the read + system-call is retried if we handle a signal (for example + SIGUSR[12]) while we are trying to read the errno vlaue from the + child process. + Fix misleading message from import-gnulib.sh; allow .git symlink. * import-gnulib.sh (check_old_gnulib_dir_layout): Really apply the bugfix by Kamil Dudka which eliminates a misleading message of diff --git a/NEWS b/NEWS index dfcefd4c..6c897962 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,10 @@ database, though they are in the ChangeLog: *** Don't delete header files in "lib/" for "make clean". +These following fixed bugs are recorded at +https://savannah.gnu.org/bugs/?group=findutils: + +#38583: errno-buffer read failed in xargs_do_exec * Major changes in release 4.5.11, 2013-02-02 diff --git a/import-gnulib.config b/import-gnulib.config index c621804c..a60ac4b2 100644 --- a/import-gnulib.config +++ b/import-gnulib.config @@ -110,6 +110,7 @@ readlink realloc regex rpmatch +safe-read save-cwd savedir selinux-at diff --git a/xargs/xargs.c b/xargs/xargs.c index 5fd93cdb..92390a92 100644 --- a/xargs/xargs.c +++ b/xargs/xargs.c @@ -51,6 +51,7 @@ #include "gettext.h" #include "progname.h" #include "quotearg.h" +#include "safe-read.h" #include "verify.h" #include "xalloc.h" @@ -1251,13 +1252,15 @@ xargs_do_exec (struct buildcmd_control *ctl, void *usercontext, int argc, char * } /* switch (child) */ /*fprintf (stderr, "forked child (bc_state.cmd_argc=%d) -> ", bc_state.cmd_argc);*/ - switch (r = read (fd[0], &buf, sizeof (int))) + /* We use safe_read here in order to avoid an error if + SIGUSR[12] is handled during the read system call. */ + switch (r = safe_read (fd[0], &buf, sizeof (int))) { - case -1: + case SAFE_READ_ERROR: { close (fd[0]); error (0, errno, - _("errno-buffer read failed in xargs_do_exec " + _("errno-buffer safe_read failed in xargs_do_exec " "(this is probably a bug, please report it)")); break; }