summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdk-stage1/mar/mar-extract-only.c11
-rw-r--r--mdk-stage1/mar/mar-frontend.c11
2 files changed, 10 insertions, 12 deletions
diff --git a/mdk-stage1/mar/mar-extract-only.c b/mdk-stage1/mar/mar-extract-only.c
index fc9e9e55f..ec99da114 100644
--- a/mdk-stage1/mar/mar-extract-only.c
+++ b/mdk-stage1/mar/mar-extract-only.c
@@ -171,16 +171,13 @@ mar_open_file(char *filename, struct mar_stream *s)
/* verify integrity */
if (s->crc32 != mar_calc_integrity(s))
+ log_message("ERROR! mar_open_file: CRC check failed (trying to continue)");
+
+ if (gzseek(s->mar_gzfile, sizeof(int), SEEK_SET) != sizeof(int))
{
- log_message("E: mar::open_marfile CRC check failed");
+ gzerr(s->mar_gzfile);
return -1;
}
- else
- if (gzseek(s->mar_gzfile, sizeof(int), SEEK_SET) != sizeof(int))
- {
- gzerr(s->mar_gzfile);
- return -1;
- }
while (end_filetable == 0)
{
diff --git a/mdk-stage1/mar/mar-frontend.c b/mdk-stage1/mar/mar-frontend.c
index b9c645b58..6f15f3785 100644
--- a/mdk-stage1/mar/mar-frontend.c
+++ b/mdk-stage1/mar/mar-frontend.c
@@ -86,14 +86,15 @@ mar_create_file(char *dest_file, char **files)
total_length += fsiz;
filenum++;
}
- temp_marfile_buffer = (char *) alloca(total_length); /* create the whole file in-memory */
+
+ temp_marfile_buffer = (char *) malloc(total_length); /* create the whole file in-memory (not with alloca! it can be bigger than typical limit for stack of programs (ulimit -s) */
DEBUG_MAR(printf("D: mar::create_marfile total-length %d\n", total_length););
current_offset_filetable = sizeof(int); /* first file is after the crc */
filenum = 0;
while (files[filenum])
{
- FILE * f = fopen(files[filenum], "rb");
+ FILE * f = fopen(files[filenum], "r");
int fsize;
if (!f)
{
@@ -143,7 +144,7 @@ mar_create_file(char *dest_file, char **files)
/* ok, buffer is ready, let's write it on-disk */
{
- gzFile f = gzopen(dest_file, "wb9");
+ gzFile f = gzopen(dest_file, "w9");
if (!f)
{
perror(dest_file);
@@ -207,11 +208,11 @@ main(int argc, char **argv)
}
if ((strcmp(argv[1], "-c") == 0) && argc >= 4)
{
- char **files = (char **) malloc(((argc-3)+1) * sizeof(char *));
+ char **files = (char **) alloca(((argc-3)+1) * sizeof(char *));
int i = 3;
while (i < argc)
{
- files[i-3] = strdup(argv[i]);
+ files[i-3] = argv[i];
i++;
}
files[argc-3] = NULL;