diff options
-rw-r--r-- | shell/ash.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/shell/ash.c b/shell/ash.c index 4ae42595d..712286fbd 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -15899,21 +15899,11 @@ spawn_forkshell(struct forkshell *fs, struct job *jp, union node *n, int mode) | |||
15899 | * When this memory is mapped elsewhere, pointer fixup will be needed | 15899 | * When this memory is mapped elsewhere, pointer fixup will be needed |
15900 | */ | 15900 | */ |
15901 | 15901 | ||
15902 | /* redefine without test that relocate is non-NULL */ | 15902 | /* redefine without test that fs_size is nonzero */ |
15903 | #undef SAVE_PTR | 15903 | #undef SAVE_PTR |
15904 | #undef SAVE_PTR2 | 15904 | #undef SAVE_PTR2 |
15905 | #undef SAVE_PTR3 | 15905 | #undef SAVE_PTR3 |
15906 | # define SAVE_PTR(dst,note,flag) { \ | 15906 | #define SAVE_PTR(dst,note,flag) {MARK_PTR(dst,flag); ANNOT(dst,note);} |
15907 | MARK_PTR(dst,flag); ANNOT(dst,note); \ | ||
15908 | } | ||
15909 | # define SAVE_PTR2(dst1,note1,flag1,dst2,note2,flag2) { \ | ||
15910 | MARK_PTR(dst1,flag1); MARK_PTR(dst2,flag2); \ | ||
15911 | ANNOT(dst1,note1); ANNOT(dst2,note2); \ | ||
15912 | } | ||
15913 | # define SAVE_PTR3(dst1,note1,flag1,dst2,note2,flag2,dst3,note3,flag3) { \ | ||
15914 | MARK_PTR(dst1,flag1); MARK_PTR(dst2,flag2); MARK_PTR(dst3,flag3); \ | ||
15915 | ANNOT(dst1,note1); ANNOT(dst2,note2); ANNOT(dst3,note3); \ | ||
15916 | } | ||
15917 | 15907 | ||
15918 | static int align_len(const char *s) | 15908 | static int align_len(const char *s) |
15919 | { | 15909 | { |
@@ -16270,13 +16260,13 @@ globals_misc_copy(struct globals_misc *p) | |||
16270 | new->physdir = p->physdir != p->nullstr ? nodeckstrdup(p->physdir) : new->nullstr; | 16260 | new->physdir = p->physdir != p->nullstr ? nodeckstrdup(p->physdir) : new->nullstr; |
16271 | new->arg0 = nodeckstrdup(p->arg0); | 16261 | new->arg0 = nodeckstrdup(p->arg0); |
16272 | new->commandname = nodeckstrdup(p->commandname); | 16262 | new->commandname = nodeckstrdup(p->commandname); |
16273 | SAVE_PTR3( | 16263 | SAVE_PTR(new->minusc, xasprintf("minusc '%s'", p->minusc ?: "NULL"), FREE); |
16274 | new->minusc, xasprintf("minusc '%s'", p->minusc ?: "NULL"), FREE, | 16264 | SAVE_PTR(new->curdir, |
16275 | new->curdir, xasprintf("curdir '%s'", new->curdir ?: "NULL"), FREE, | 16265 | xasprintf("curdir '%s'", new->curdir ?: "NULL"), FREE); |
16276 | new->physdir, xasprintf("physdir '%s'", new->physdir ?: "NULL"), FREE); | 16266 | SAVE_PTR(new->physdir, |
16277 | SAVE_PTR2( | 16267 | xasprintf("physdir '%s'", new->physdir ?: "NULL"), FREE); |
16278 | new->arg0, xasprintf("arg0 '%s'", p->arg0 ?: "NULL"), FREE, | 16268 | SAVE_PTR(new->arg0, xasprintf("arg0 '%s'", p->arg0 ?: "NULL"), FREE); |
16279 | new->commandname, | 16269 | SAVE_PTR(new->commandname, |
16280 | xasprintf("commandname '%s'", p->commandname ?: "NULL"), FREE); | 16270 | xasprintf("commandname '%s'", p->commandname ?: "NULL"), FREE); |
16281 | return new; | 16271 | return new; |
16282 | } | 16272 | } |
@@ -16322,14 +16312,14 @@ forkshell_copy(struct forkshell *fs, struct forkshell *new) | |||
16322 | new->gvp = globals_var_copy(ash_ptr_to_globals_var); | 16312 | new->gvp = globals_var_copy(ash_ptr_to_globals_var); |
16323 | new->gmp = globals_misc_copy(ash_ptr_to_globals_misc); | 16313 | new->gmp = globals_misc_copy(ash_ptr_to_globals_misc); |
16324 | new->cmdtable = cmdtable_copy(cmdtable); | 16314 | new->cmdtable = cmdtable_copy(cmdtable); |
16325 | SAVE_PTR3(new->gvp, "gvp", NO_FREE, | 16315 | SAVE_PTR(new->gvp, "gvp", NO_FREE); |
16326 | new->gmp, "gmp", NO_FREE, | 16316 | SAVE_PTR(new->gmp, "gmp", NO_FREE); |
16327 | new->cmdtable, "cmdtable", NO_FREE); | 16317 | SAVE_PTR(new->cmdtable, "cmdtable", NO_FREE); |
16328 | 16318 | ||
16329 | new->n = copynode(fs->n); | 16319 | new->n = copynode(fs->n); |
16330 | new->argv = argv_copy(fs->argv); | 16320 | new->argv = argv_copy(fs->argv); |
16331 | SAVE_PTR2( new->n, "n", NO_FREE, | 16321 | SAVE_PTR(new->n, "n", NO_FREE); |
16332 | new->argv, "argv", NO_FREE); | 16322 | SAVE_PTR(new->argv, "argv", NO_FREE); |
16333 | 16323 | ||
16334 | if ((ENABLE_ASH_ALIAS || MAX_HISTORY) && fs->fpid != FS_SHELLEXEC) { | 16324 | if ((ENABLE_ASH_ALIAS || MAX_HISTORY) && fs->fpid != FS_SHELLEXEC) { |
16335 | #if ENABLE_ASH_ALIAS | 16325 | #if ENABLE_ASH_ALIAS |