summaryrefslogtreecommitdiff
path: root/lib/sh/zmapfd.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2020-09-09 15:25:32 -0400
committerChet Ramey <chet.ramey@case.edu>2020-09-09 15:25:32 -0400
commit3eb0018e75b74bb886df7fba4b1712529ce7258f (patch)
tree13b53713ef8f483a82295324e314da48b59c9346 /lib/sh/zmapfd.c
parent712f80b0a49c3a0227d0b52bff5e0b763747697e (diff)
downloadbash-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.c10
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;
}