mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-06 03:40:50 +02:00
commit bash-20171201 snapshot
This commit is contained in:
@@ -14531,3 +14531,21 @@ config-top.h
|
||||
Makefile.in
|
||||
- pathexp.o: add dependencies on libintl.h. Reported by
|
||||
Ross Burton <ross@burtonini.com>
|
||||
|
||||
12/1
|
||||
----
|
||||
lib/sh/ufuncs.c
|
||||
- fsleep: add blocking and releasing SIGCHLD using sigprocmask
|
||||
around call to select(2) even if pselect(2) is not available
|
||||
|
||||
12/3
|
||||
----
|
||||
execute_cmd.c
|
||||
- coproc_setstatus: new utility function, take a pointer to a coproc
|
||||
and a status and mark the coproc as dead and having been reaped
|
||||
with that status. Used by child processes who want to invalidate
|
||||
the coproc's pid
|
||||
- coproc_closeall,cpl_closeall: call coproc_setstatus (to invalidate
|
||||
pid) after closing a coproc (invalidating FDs). Fixes issue with
|
||||
spurious warning reported by Tobias Hoffmann
|
||||
<lfile-list@thax.hardliners.org>
|
||||
|
||||
+22
-11
@@ -183,6 +183,7 @@ static char *getinterp __P((char *, int, int *));
|
||||
static void initialize_subshell __P((void));
|
||||
static int execute_in_subshell __P((COMMAND *, int, int, int, struct fd_bitmap *));
|
||||
#if defined (COPROCESS_SUPPORT)
|
||||
static void coproc_setstatus __P((struct coproc *, int));
|
||||
static int execute_coproc __P((COMMAND *, int, int, struct fd_bitmap *));
|
||||
#endif
|
||||
|
||||
@@ -1847,7 +1848,10 @@ cpl_closeall ()
|
||||
struct cpelement *cpe;
|
||||
|
||||
for (cpe = coproc_list.head; cpe; cpe = cpe->next)
|
||||
coproc_close (cpe->coproc);
|
||||
{
|
||||
coproc_close (cpe->coproc);
|
||||
coproc_setstatus (cpe->coproc, 0); /* fake zero status */
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2048,6 +2052,7 @@ coproc_closeall ()
|
||||
cpl_closeall ();
|
||||
#else
|
||||
coproc_close (&sh_coproc); /* XXX - will require changes for multiple coprocs */
|
||||
coproc_setstatus (&sh_coproc, 0); /* fake zero status */
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2142,6 +2147,21 @@ coproc_fdrestore (cp)
|
||||
cp->c_wfd = cp->c_wsave;
|
||||
}
|
||||
|
||||
static void
|
||||
coproc_setstatus (cp, status)
|
||||
struct coproc *cp;
|
||||
int status;
|
||||
{
|
||||
cp->c_lock = 4;
|
||||
cp->c_status = status;
|
||||
cp->c_flags |= COPROC_DEAD;
|
||||
cp->c_flags &= ~COPROC_RUNNING;
|
||||
/* Don't dispose the coproc or unset the COPROC_XXX variables because
|
||||
this is executed in a signal handler context. Wait until coproc_reap
|
||||
takes care of it. */
|
||||
cp->c_lock = 0;
|
||||
}
|
||||
|
||||
void
|
||||
coproc_pidchk (pid, status)
|
||||
pid_t pid;
|
||||
@@ -2160,16 +2180,7 @@ coproc_pidchk (pid, status)
|
||||
cp = getcoprocbypid (pid);
|
||||
#endif
|
||||
if (cp)
|
||||
{
|
||||
cp->c_lock = 4;
|
||||
cp->c_status = status;
|
||||
cp->c_flags |= COPROC_DEAD;
|
||||
cp->c_flags &= ~COPROC_RUNNING;
|
||||
/* Don't dispose the coproc or unset the COPROC_XXX variables because
|
||||
this is executed in a signal handler context. Wait until coproc_reap
|
||||
takes care of it. */
|
||||
cp->c_lock = 0;
|
||||
}
|
||||
coproc_setstatus (cp, status);
|
||||
}
|
||||
|
||||
pid_t
|
||||
|
||||
+6
-2
@@ -98,21 +98,23 @@ fsleep(sec, usec)
|
||||
unsigned int sec, usec;
|
||||
{
|
||||
int e, r;
|
||||
sigset_t blocked_sigs, prevmask;
|
||||
#if defined (HAVE_PSELECT)
|
||||
sigset_t blocked_sigs;
|
||||
struct timespec ts;
|
||||
#else
|
||||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_PSELECT)
|
||||
sigemptyset (&blocked_sigs);
|
||||
# if defined (SIGCHLD)
|
||||
sigaddset (&blocked_sigs, SIGCHLD);
|
||||
# endif
|
||||
|
||||
#if defined (HAVE_PSELECT)
|
||||
ts.tv_sec = sec;
|
||||
ts.tv_nsec = usec * 1000;
|
||||
#else
|
||||
sigemptyset (&prevmask);
|
||||
tv.tv_sec = sec;
|
||||
tv.tv_usec = usec;
|
||||
#endif /* !HAVE_PSELECT */
|
||||
@@ -122,7 +124,9 @@ fsleep(sec, usec)
|
||||
#if defined (HAVE_PSELECT)
|
||||
r = pselect(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &ts, &blocked_sigs);
|
||||
#else
|
||||
sigprocmask (SIG_SETMASK, &blocked_sigs, &prevmask);
|
||||
r = select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tv);
|
||||
sigprocmask (SIG_SETMASK, &prevmask, NULL);
|
||||
#endif
|
||||
e = errno;
|
||||
if (r < 0 && errno == EINTR)
|
||||
|
||||
Reference in New Issue
Block a user