summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/mar
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-01-02 23:30:15 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-01-02 23:30:15 +0000
commit6fc74b08e8a042b0a47c1388f90ab64c0ba70b0e (patch)
tree3a34870f355158fbd1e34a457327060a3c331015 /mdk-stage1/mar
parente441f417bbd3c9f223668bfb0720cda739860811 (diff)
downloaddrakx-backup-do-not-use-6fc74b08e8a042b0a47c1388f90ab64c0ba70b0e.tar
drakx-backup-do-not-use-6fc74b08e8a042b0a47c1388f90ab64c0ba70b0e.tar.gz
drakx-backup-do-not-use-6fc74b08e8a042b0a47c1388f90ab64c0ba70b0e.tar.bz2
drakx-backup-do-not-use-6fc74b08e8a042b0a47c1388f90ab64c0ba70b0e.tar.xz
drakx-backup-do-not-use-6fc74b08e8a042b0a47c1388f90ab64c0ba70b0e.zip
vacances:
- use malloc instead of alloca for big main allocation since on some systems (LM-7.2 for example it seems) the stack size is limited to 2048 kbyt es - don't give up when the CRC is not OK, but tries to continue anyway
Diffstat (limited to 'mdk-stage1/mar')
-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;