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.
This commit is contained in:
James Youngman
2013-03-24 21:54:35 +00:00
parent c1dc4c7802
commit 14adbdd321
4 changed files with 18 additions and 3 deletions

View File

@@ -1,5 +1,12 @@
2013-03-24 James Youngman <jay@gnu.org>
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

4
NEWS
View File

@@ -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

View File

@@ -110,6 +110,7 @@ readlink
realloc
regex
rpmatch
safe-read
save-cwd
savedir
selinux-at

View File

@@ -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;
}