diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-07 03:17:28 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-07 03:17:28 +0200 |
commit | f37e1155aabde6bd95d267a8aec347cedccb8bc3 (patch) | |
tree | 31294cfdf3fc1d83cb7ab0021c29bc73b8803651 /shell/ash.c | |
parent | 2972e2c4acb9c46a8cc05c857acac2b3d439bf69 (diff) | |
download | busybox-w32-f37e1155aabde6bd95d267a8aec347cedccb8bc3.tar.gz busybox-w32-f37e1155aabde6bd95d267a8aec347cedccb8bc3.tar.bz2 busybox-w32-f37e1155aabde6bd95d267a8aec347cedccb8bc3.zip |
ash: comment out free(p) just before _exit, tweak some outdated comments
Planned to sync exitshell up to dash, turned out ours is better :)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/shell/ash.c b/shell/ash.c index a317d0080..9a4448f18 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -474,7 +474,7 @@ raise_exception(int e) | |||
474 | #endif | 474 | #endif |
475 | 475 | ||
476 | /* | 476 | /* |
477 | * Called from trap.c when a SIGINT is received. (If the user specifies | 477 | * Called when a SIGINT is received. (If the user specifies |
478 | * that SIGINT is to be trapped or ignored using the trap builtin, then | 478 | * that SIGINT is to be trapped or ignored using the trap builtin, then |
479 | * this routine is not called.) Suppressint is nonzero when interrupts | 479 | * this routine is not called.) Suppressint is nonzero when interrupts |
480 | * are held using the INT_OFF macro. (The test for iflag is just | 480 | * are held using the INT_OFF macro. (The test for iflag is just |
@@ -3357,8 +3357,6 @@ unaliascmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
3357 | #endif /* ASH_ALIAS */ | 3357 | #endif /* ASH_ALIAS */ |
3358 | 3358 | ||
3359 | 3359 | ||
3360 | /* ============ jobs.c */ | ||
3361 | |||
3362 | /* Mode argument to forkshell. Don't change FORK_FG or FORK_BG. */ | 3360 | /* Mode argument to forkshell. Don't change FORK_FG or FORK_BG. */ |
3363 | #define FORK_FG 0 | 3361 | #define FORK_FG 0 |
3364 | #define FORK_BG 1 | 3362 | #define FORK_BG 1 |
@@ -8161,8 +8159,6 @@ commandcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
8161 | #endif | 8159 | #endif |
8162 | 8160 | ||
8163 | 8161 | ||
8164 | /* ============ eval.c */ | ||
8165 | |||
8166 | static int funcblocksize; /* size of structures in function */ | 8162 | static int funcblocksize; /* size of structures in function */ |
8167 | static int funcstringsize; /* size of strings in node */ | 8163 | static int funcstringsize; /* size of strings in node */ |
8168 | static void *funcblock; /* block to allocate function from */ | 8164 | static void *funcblock; /* block to allocate function from */ |
@@ -12745,8 +12741,6 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
12745 | } | 12741 | } |
12746 | 12742 | ||
12747 | 12743 | ||
12748 | /* ============ trap.c */ | ||
12749 | |||
12750 | /* | 12744 | /* |
12751 | * The trap builtin. | 12745 | * The trap builtin. |
12752 | */ | 12746 | */ |
@@ -13172,15 +13166,10 @@ exitshell(void) | |||
13172 | #if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT | 13166 | #if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT |
13173 | save_history(line_input_state); | 13167 | save_history(line_input_state); |
13174 | #endif | 13168 | #endif |
13175 | |||
13176 | status = exitstatus; | 13169 | status = exitstatus; |
13177 | TRACE(("pid %d, exitshell(%d)\n", getpid(), status)); | 13170 | TRACE(("pid %d, exitshell(%d)\n", getpid(), status)); |
13178 | if (setjmp(loc.loc)) { | 13171 | if (setjmp(loc.loc)) { |
13179 | if (exception_type == EXEXIT) | 13172 | if (exception_type == EXEXIT) |
13180 | /* dash bug: it just does _exit(exitstatus) here | ||
13181 | * but we have to do setjobctl(0) first! | ||
13182 | * (bug is still not fixed in dash-0.5.3 - if you run dash | ||
13183 | * under Midnight Commander, on exit from dash MC is backgrounded) */ | ||
13184 | status = exitstatus; | 13173 | status = exitstatus; |
13185 | goto out; | 13174 | goto out; |
13186 | } | 13175 | } |
@@ -13190,10 +13179,13 @@ exitshell(void) | |||
13190 | trap[0] = NULL; | 13179 | trap[0] = NULL; |
13191 | evalskip = 0; | 13180 | evalskip = 0; |
13192 | evalstring(p, 0); | 13181 | evalstring(p, 0); |
13193 | free(p); | 13182 | /*free(p); - we'll exit soon */ |
13194 | } | 13183 | } |
13195 | flush_stdout_stderr(); | 13184 | flush_stdout_stderr(); |
13196 | out: | 13185 | out: |
13186 | /* dash wraps setjobctl(0) in "if (setjmp(loc.loc) == 0) {...}". | ||
13187 | * our setjobctl(0) does not panic if tcsetpgrp fails inside it. | ||
13188 | */ | ||
13197 | setjobctl(0); | 13189 | setjobctl(0); |
13198 | _exit(status); | 13190 | _exit(status); |
13199 | /* NOTREACHED */ | 13191 | /* NOTREACHED */ |
@@ -13202,18 +13194,15 @@ exitshell(void) | |||
13202 | static void | 13194 | static void |
13203 | init(void) | 13195 | init(void) |
13204 | { | 13196 | { |
13205 | /* from input.c: */ | ||
13206 | /* we will never free this */ | 13197 | /* we will never free this */ |
13207 | basepf.next_to_pgetc = basepf.buf = ckmalloc(IBUFSIZ); | 13198 | basepf.next_to_pgetc = basepf.buf = ckmalloc(IBUFSIZ); |
13208 | 13199 | ||
13209 | /* from trap.c: */ | ||
13210 | signal(SIGCHLD, SIG_DFL); | 13200 | signal(SIGCHLD, SIG_DFL); |
13211 | /* bash re-enables SIGHUP which is SIG_IGNed on entry. | 13201 | /* bash re-enables SIGHUP which is SIG_IGNed on entry. |
13212 | * Try: "trap '' HUP; bash; echo RET" and type "kill -HUP $$" | 13202 | * Try: "trap '' HUP; bash; echo RET" and type "kill -HUP $$" |
13213 | */ | 13203 | */ |
13214 | signal(SIGHUP, SIG_DFL); | 13204 | signal(SIGHUP, SIG_DFL); |
13215 | 13205 | ||
13216 | /* from var.c: */ | ||
13217 | { | 13206 | { |
13218 | char **envp; | 13207 | char **envp; |
13219 | const char *p; | 13208 | const char *p; |