summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2002-06-02 19:20:37 +0000
committermarcel <marcel@FreeBSD.org>2002-06-02 19:20:37 +0000
commit4ecb10ebe3790f262037d0fb36e6340ef1502f43 (patch)
tree09bb2d85a90c79c1621fc585c4f300ca8f29bb00 /sbin
parent4769e37d2a52e2f9788f7fe4b45b63107b9f08bc (diff)
downloadFreeBSD-src-4ecb10ebe3790f262037d0fb36e6340ef1502f43.zip
FreeBSD-src-4ecb10ebe3790f262037d0fb36e6340ef1502f43.tar.gz
Fix breakage caused by allocating the I/O buffer. There was a
sizeof(buf) lurking around that I missed. PR: 38811 Submitted by: Adrian Colley <aecolley@spamcop.net>
Diffstat (limited to 'sbin')
-rw-r--r--sbin/savecore/savecore.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
index 56ee242..6cd5e2c 100644
--- a/sbin/savecore/savecore.c
+++ b/sbin/savecore/savecore.c
@@ -85,6 +85,9 @@ __FBSDID("$FreeBSD$");
#include <time.h>
#include <unistd.h>
+/* The size of the buffer used for I/O. */
+#define BUFFERSIZE (1024*1024)
+
int compress, clear, force, keep, verbose; /* flags */
int nfound, nsaved, nerr; /* statistics */
@@ -225,7 +228,7 @@ DoFile(char *savedir, const char *device)
* this by doing a on-time allocation...
*/
if (buf == NULL) {
- buf = malloc(1024 * 1024);
+ buf = malloc(BUFFERSIZE);
if (buf == NULL) {
syslog(LOG_ERR, "%m");
return;
@@ -371,7 +374,7 @@ DoFile(char *savedir, const char *device)
compress ? "compressed " : "", buf);
while (dumpsize > 0) {
- wl = sizeof(buf);
+ wl = BUFFERSIZE;
if (wl > dumpsize)
wl = dumpsize;
nr = read(fd, buf, wl);
OpenPOWER on IntegriCloud