commit bash-20160930 snapshot

This commit is contained in:
Chet Ramey
2016-10-19 15:13:16 -04:00
parent 61c476d20d
commit 64a7a6249f
21 changed files with 949 additions and 1633 deletions
+13 -2
View File
@@ -420,12 +420,23 @@ _hs_append_history_line (which, line)
const char *line;
{
HIST_ENTRY *hent;
size_t newlen, curlen;
size_t newlen, curlen, minlen;
char *newline;
hent = the_history[which];
curlen = strlen (hent->line);
newlen = curlen + strlen (line) + 2;
minlen = curlen + strlen (line) + 2; /* min space needed */
if (curlen > 256) /* XXX - for now */
{
newlen = 512; /* now realloc in powers of 2 */
/* we recalcluate every time; the operations are cheap */
while (newlen < minlen)
newlen <<= 1;
}
else
newlen = minlen;
/* Assume that realloc returns the same pointer and doesn't try a new
alloc/copy if the new size is the same as the one last passed. */
newline = realloc (hent->line, newlen);
if (newline)
{
+9 -14
View File
@@ -37,7 +37,10 @@ extern int errno;
# define SEEK_CUR 1
#endif
extern int executing_builtin;
extern void check_signals_and_traps (void);
extern void check_signals (void);
extern int signal_is_trapped (int);
/* Read LEN bytes from FD into BUF. Retry the read on EINTR. Any other
@@ -50,21 +53,13 @@ zread (fd, buf, len)
{
ssize_t r;
#if 0
#if defined (HAVE_SIGINTERRUPT)
if (signal_is_trapped (SIGCHLD))
siginterrupt (SIGCHLD, 1);
#endif
#endif
while ((r = read (fd, buf, len)) < 0 && errno == EINTR)
check_signals_and_traps (); /* XXX - should it be check_signals()? */
#if 0
#if defined (HAVE_SIGINTERRUPT)
siginterrupt (SIGCHLD, 0);
#endif
#endif
/* XXX - bash-5.0 */
/* We check executing_builtin and run traps here for backwards compatibility */
if (executing_builtin)
check_signals_and_traps (); /* XXX - should it be check_signals()? */
else
check_signals ();
return r;
}