mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-11 04:30:44 +02:00
commit bash-20160930 snapshot
This commit is contained in:
+13
-2
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user