]>
Commit | Line | Data |
---|---|---|
5545a732 JR |
1 | - mkfs.cramfs dies creating Fedora installer image |
2 | ||
3 | --- util-linux-2.13-pre5/disk-utils/mkfs.cramfs.c.maxentries 2005-10-20 23:46:19.000000000 +0200 | |
4 | +++ util-linux-2.13-pre5/disk-utils/mkfs.cramfs.c 2005-10-20 23:54:07.000000000 +0200 | |
5 | @@ -471,11 +471,13 @@ | |
6 | * entries, using a stack to remember the directories | |
7 | * we've seen. | |
8 | */ | |
9 | -#define MAXENTRIES (100) | |
10 | static unsigned int write_directory_structure(struct entry *entry, char *base, unsigned int offset) | |
11 | { | |
12 | int stack_entries = 0; | |
13 | - struct entry *entry_stack[MAXENTRIES]; | |
14 | + int stack_size = 64; | |
15 | + struct entry **entry_stack; | |
16 | + | |
17 | + entry_stack = xmalloc(stack_size * sizeof(struct entry *)); | |
18 | ||
19 | for (;;) { | |
20 | int dir_start = stack_entries; | |
21 | @@ -508,13 +510,13 @@ | |
22 | if (verbose) | |
23 | printf(" %s\n", entry->name); | |
24 | if (entry->child) { | |
25 | - if (stack_entries >= MAXENTRIES) { | |
26 | - fprintf(stderr, | |
27 | - _("Exceeded MAXENTRIES. Raise" | |
28 | - " this value in mkcramfs.c " | |
29 | - "and recompile. Exiting.\n") | |
30 | - ); | |
31 | - exit(8); | |
32 | + if (stack_entries >= stack_size) { | |
33 | + stack_size *= 2; | |
34 | + entry_stack = realloc(entry_stack, stack_size * sizeof(struct entry *)); | |
35 | + if (!entry_stack) { | |
36 | + perror(NULL); | |
37 | + exit(8); /* out of memory */ | |
38 | + } | |
39 | } | |
40 | entry_stack[stack_entries] = entry; | |
41 | stack_entries++; | |
42 | @@ -551,6 +553,7 @@ | |
43 | printf("'%s':\n", entry->name); | |
44 | entry = entry->child; | |
45 | } | |
46 | + free(entry_stack); | |
47 | return offset; | |
48 | } | |
49 |