diff options
author | Chet Ramey <chet.ramey@case.edu> | 2020-09-09 15:25:32 -0400 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2020-09-09 15:25:32 -0400 |
commit | 3eb0018e75b74bb886df7fba4b1712529ce7258f (patch) | |
tree | 13b53713ef8f483a82295324e314da48b59c9346 /lib/sh/zmapfd.c | |
parent | 712f80b0a49c3a0227d0b52bff5e0b763747697e (diff) | |
download | bash-5.1-beta.tar.gz |
bash-5.1 beta releasebash-5.1-beta
Diffstat (limited to 'lib/sh/zmapfd.c')
-rw-r--r-- | lib/sh/zmapfd.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/sh/zmapfd.c b/lib/sh/zmapfd.c index f3fb8473..f9e9ed71 100644 --- a/lib/sh/zmapfd.c +++ b/lib/sh/zmapfd.c @@ -36,6 +36,10 @@ extern int errno; #endif +#ifndef ZBUFSIZ +# define ZBUFSIZ 4096 +#endif + extern ssize_t zread PARAMS((int, char *, size_t)); /* Dump contents of file descriptor FD to *OSTR. FN is the filename for @@ -48,12 +52,12 @@ zmapfd (fd, ostr, fn) { ssize_t nr; int rval; - char lbuf[512]; + char lbuf[ZBUFSIZ]; char *result; int rsize, rind; rval = 0; - result = (char *)xmalloc (rsize = 512); + result = (char *)xmalloc (rsize = ZBUFSIZ); rind = 0; while (1) @@ -72,7 +76,7 @@ zmapfd (fd, ostr, fn) return -1; } - RESIZE_MALLOCED_BUFFER (result, rind, nr, rsize, 512); + RESIZE_MALLOCED_BUFFER (result, rind, nr, rsize, ZBUFSIZ); memcpy (result+rind, lbuf, nr); rind += nr; } |