aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/shell/ash.c b/shell/ash.c
index afa9f271b..c5b9741d6 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8308,7 +8308,7 @@ static void *funcblock; /* block to allocate function from */
8308static char *funcstring; /* block to allocate strings from */ 8308static char *funcstring; /* block to allocate strings from */
8309#if ENABLE_PLATFORM_MINGW32 8309#if ENABLE_PLATFORM_MINGW32
8310static int nodeptrsize; 8310static int nodeptrsize;
8311static int *nodeptr; 8311static char **nodeptr;
8312#endif 8312#endif
8313 8313
8314/* flags in argument to evaltree */ 8314/* flags in argument to evaltree */
@@ -8470,10 +8470,10 @@ nodeckstrdup(const char *s)
8470static union node *copynode(union node *); 8470static union node *copynode(union node *);
8471 8471
8472#if ENABLE_PLATFORM_MINGW32 8472#if ENABLE_PLATFORM_MINGW32
8473# define SAVE_PTR(dst) {if (nodeptr) *nodeptr++ = (int)&(dst);} 8473# define SAVE_PTR(dst) {if (nodeptr) *nodeptr++ = (char *)&(dst);}
8474# define SAVE_PTR2(dst1,dst2) {if (nodeptr) { *nodeptr++ = (int)&(dst1);*nodeptr++ = (int)&(dst2);}} 8474# define SAVE_PTR2(dst1,dst2) {if (nodeptr) { *nodeptr++ = (char *)&(dst1);*nodeptr++ = (char *)&(dst2);}}
8475# define SAVE_PTR3(dst1,dst2,dst3) {if (nodeptr) { *nodeptr++ = (int)&(dst1);*nodeptr++ = (int)&(dst2);*nodeptr++ = (int)&(dst3);}} 8475# define SAVE_PTR3(dst1,dst2,dst3) {if (nodeptr) { *nodeptr++ = (char *)&(dst1);*nodeptr++ = (char *)&(dst2);*nodeptr++ = (char *)&(dst3);}}
8476# define SAVE_PTR4(dst1,dst2,dst3,dst4) {if (nodeptr) { *nodeptr++ = (int)&(dst1);*nodeptr++ = (int)&(dst2);*nodeptr++ = (int)&(dst3);*nodeptr++ = (int)&(dst4);}} 8476# define SAVE_PTR4(dst1,dst2,dst3,dst4) {if (nodeptr) { *nodeptr++ = (char *)&(dst1);*nodeptr++ = (char *)&(dst2);*nodeptr++ = (char *)&(dst3);*nodeptr++ = (char *)&(dst4);}}
8477#else 8477#else
8478# define SAVE_PTR(dst) 8478# define SAVE_PTR(dst)
8479# define SAVE_PTR2(dst,dst2) 8479# define SAVE_PTR2(dst,dst2)
@@ -14392,7 +14392,7 @@ forkshell_prepare(struct forkshell *fs)
14392 funcblocksize = 0; 14392 funcblocksize = 0;
14393 funcstringsize = 0; 14393 funcstringsize = 0;
14394 forkshell_size(fs); 14394 forkshell_size(fs);
14395 size = funcblocksize + funcstringsize + nodeptrsize*sizeof(int); 14395 size = funcblocksize + funcstringsize + nodeptrsize*sizeof(char *);
14396 14396
14397 /* Allocate, initialize pointers */ 14397 /* Allocate, initialize pointers */
14398 memset(&sa, 0, sizeof(sa)); 14398 memset(&sa, 0, sizeof(sa));
@@ -14404,14 +14404,14 @@ forkshell_prepare(struct forkshell *fs)
14404 /* new = ckmalloc(size); */ 14404 /* new = ckmalloc(size); */
14405 funcblock = new; 14405 funcblock = new;
14406 funcstring = (char *) funcblock + funcblocksize; 14406 funcstring = (char *) funcblock + funcblocksize;
14407 nodeptr = (int*)((char *) funcstring + funcstringsize); 14407 nodeptr = (char **)((char *)funcstring + funcstringsize);
14408 nodeptr_offset = (int) nodeptr - (int) new; 14408 nodeptr_offset = (char *)nodeptr - (char *)new;
14409 14409
14410 /* Now pack them all */ 14410 /* Now pack them all */
14411 forkshell_copy(fs); 14411 forkshell_copy(fs);
14412 14412
14413 /* Finish it up */ 14413 /* Finish it up */
14414 *nodeptr = 0; 14414 *nodeptr = NULL;
14415 new->size = size; 14415 new->size = size;
14416 new->nodeptr_offset = nodeptr_offset; 14416 new->nodeptr_offset = nodeptr_offset;
14417 new->old_base = new; 14417 new->old_base = new;
@@ -14432,6 +14432,7 @@ forkshell_init(const char *idstr)
14432 struct globals_var **gvpp; 14432 struct globals_var **gvpp;
14433 struct globals_misc **gmpp; 14433 struct globals_misc **gmpp;
14434 int i; 14434 int i;
14435 char **ptr;
14435 14436
14436 if (sscanf(idstr, "%x", &map_handle) != 1) 14437 if (sscanf(idstr, "%x", &map_handle) != 1)
14437 bb_error_msg_and_die("invalid forkshell ID"); 14438 bb_error_msg_and_die("invalid forkshell ID");
@@ -14444,14 +14445,15 @@ forkshell_init(const char *idstr)
14444 /* this memory can't be freed */ 14445 /* this memory can't be freed */
14445 sticky_mem_start = fs; 14446 sticky_mem_start = fs;
14446 sticky_mem_end = (char *) fs + fs->size; 14447 sticky_mem_end = (char *) fs + fs->size;
14448
14447 /* pointer fixup */ 14449 /* pointer fixup */
14448 nodeptr = (int*)((char*)fs + fs->nodeptr_offset); 14450 nodeptr = (char **)((char *)fs + fs->nodeptr_offset);
14449 while (*nodeptr) { 14451 for ( i=0; nodeptr[i]; ++i ) {
14450 int *ptr = (int*)((char*)fs + (*nodeptr - (int)fs->old_base)); 14452 ptr = (char **)((char *)fs + (nodeptr[i] - (char *)fs->old_base));
14451 if (*ptr) 14453 if (*ptr)
14452 *ptr -= ((int)fs->old_base - (int)fs); 14454 *ptr = (char *)fs + (*ptr - (char *)fs->old_base);
14453 nodeptr++;
14454 } 14455 }
14456
14455 /* Now fix up stuff that can't be transferred */ 14457 /* Now fix up stuff that can't be transferred */
14456 for (i = 0; i < ARRAY_SIZE(varinit_data); i++) 14458 for (i = 0; i < ARRAY_SIZE(varinit_data); i++)
14457 fs->gvp->varinit[i].var_func = varinit_data[i].var_func; 14459 fs->gvp->varinit[i].var_func = varinit_data[i].var_func;