fix crash from compgen in a non-interactive shell; globstar option now works with complete -G; wait -p changes; some int->size_t changes

This commit is contained in:
Chet Ramey
2022-04-19 10:45:39 -04:00
parent 3be2a2ca9a
commit 7a8455e421
45 changed files with 7600 additions and 8195 deletions
+5
View File
@@ -32,6 +32,11 @@
#define MALLOC_WRAPFUNCS
/* If defined, as it is by default, use the lesscore() function to attempt
to reduce the top of the heap when freeing memory blocks larger than a
defined threshold. */
#define USE_LESSCORE
/* Generic pointer type. */
#ifndef PTR_T
# if defined (__STDC__)
+5 -4
View File
@@ -597,6 +597,7 @@ _malloc_unblock_signals (setp, osetp)
#endif
}
#if defined (USE_LESSCORE)
/* Return some memory to the system by reducing the break. This is only
called with NU > pagebucket, so we're always assured of giving back
more than one page of memory. */
@@ -617,6 +618,7 @@ lesscore (nu) /* give system back some memory */
_mstats.nlesscore[nu]++;
#endif
}
#endif /* USE_LESSCORE */
/* Ask system for more memory; add to NEXTF[NU]. BUSY[NU] must be set to 1. */
static void
@@ -1024,11 +1026,9 @@ internal_free (mem, file, line, flags)
}
#endif
#if GLIBC21
if (nunits >= LESSCORE_MIN && ((char *)p + binsize(nunits) == sbrk (0)))
#else
#if defined (USE_LESSCORE)
/* We take care of the mmap case and munmap above */
if (nunits >= LESSCORE_MIN && ((char *)p + binsize(nunits) == memtop))
#endif
{
/* If above LESSCORE_FRC, give back unconditionally. This should be set
high enough to be infrequently encountered. If between LESSCORE_MIN
@@ -1041,6 +1041,7 @@ internal_free (mem, file, line, flags)
goto free_return;
}
}
#endif /* USE_LESSCORE */
#ifdef MEMSCRAMBLE
if (p->mh_nbytes)
+7 -7
View File
@@ -167,8 +167,8 @@ getdtablesize ()
# endif
void
bcopy (s,d,n)
char *d, *s;
int n;
void *d, *s;
size_t n;
{
FASTCOPY (s, d, n);
}
@@ -180,8 +180,8 @@ bcopy (s,d,n)
# endif
void
bzero (s, n)
char *s;
int n;
void *s;
size_t n;
{
register int i;
register char *r;
@@ -197,7 +197,7 @@ bzero (s, n)
int
gethostname (name, namelen)
char *name;
int namelen;
size_t namelen;
{
int i;
struct utsname ut;
@@ -214,7 +214,7 @@ gethostname (name, namelen)
int
gethostname (name, namelen)
char *name;
int namelen;
size_t namelen;
{
strncpy (name, "unknown", namelen);
name[namelen] = '\0';
@@ -237,7 +237,7 @@ killpg (pgrp, sig)
int
mkfifo (path, mode)
char *path;
int mode;
mode_t mode;
{
#if defined (S_IFIFO)
return (mknod (path, (mode | S_IFIFO), 0));
+2 -1
View File
@@ -68,7 +68,8 @@ zgetline (fd, lineptr, n, delim, unbuffered_read)
int delim;
int unbuffered_read;
{
int nr, retval;
int retval;
size_t nr;
char *line, c;
if (lineptr == 0 || n == 0 || (*lineptr == 0 && *n != 0))
+1 -1
View File
@@ -54,7 +54,7 @@ zmapfd (fd, ostr, fn)
int rval;
char lbuf[ZBUFSIZ];
char *result;
int rsize, rind;
size_t rsize, rind;
rval = 0;
result = (char *)xmalloc (rsize = ZBUFSIZ);