Fossil SCM
Fix the "shell" command so that it avoids invoking the atexit() handler more than once.
Commit
07a5a2118e23760ea090d7b9fed3aa48b54f1bf857a22baf56e019e274bcb3c4
Parent
b2426c278669b8b…
2 files changed
+1
-1
+9
+1
-1
| --- src/fshell.c | ||
| +++ src/fshell.c | ||
| @@ -109,11 +109,11 @@ | ||
| 109 | 109 | continue; |
| 110 | 110 | } |
| 111 | 111 | if( childPid==0 ){ |
| 112 | 112 | /* This is the child process */ |
| 113 | 113 | int main(int, char**); |
| 114 | - main(nArg, azArg); | |
| 114 | + fossil_main(nArg, azArg); | |
| 115 | 115 | exit(0); |
| 116 | 116 | }else{ |
| 117 | 117 | /* The parent process */ |
| 118 | 118 | int status; |
| 119 | 119 | waitpid(childPid, &status, 0); |
| 120 | 120 |
| --- src/fshell.c | |
| +++ src/fshell.c | |
| @@ -109,11 +109,11 @@ | |
| 109 | continue; |
| 110 | } |
| 111 | if( childPid==0 ){ |
| 112 | /* This is the child process */ |
| 113 | int main(int, char**); |
| 114 | main(nArg, azArg); |
| 115 | exit(0); |
| 116 | }else{ |
| 117 | /* The parent process */ |
| 118 | int status; |
| 119 | waitpid(childPid, &status, 0); |
| 120 |
| --- src/fshell.c | |
| +++ src/fshell.c | |
| @@ -109,11 +109,11 @@ | |
| 109 | continue; |
| 110 | } |
| 111 | if( childPid==0 ){ |
| 112 | /* This is the child process */ |
| 113 | int main(int, char**); |
| 114 | fossil_main(nArg, azArg); |
| 115 | exit(0); |
| 116 | }else{ |
| 117 | /* The parent process */ |
| 118 | int status; |
| 119 | waitpid(childPid, &status, 0); |
| 120 |
+9
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -630,10 +630,19 @@ | ||
| 630 | 630 | int _CRT_glob = 0x0001; /* See MinGW bug #2062 */ |
| 631 | 631 | #endif |
| 632 | 632 | int main(int argc, char **argv) |
| 633 | 633 | #endif |
| 634 | 634 | { |
| 635 | + return fossil_main(argc, argv); | |
| 636 | +} | |
| 637 | + | |
| 638 | +/* All the work of main() is done by a separate procedure "fossil_main()". | |
| 639 | +** We have to break this out, because fossil_main() is sometimes called | |
| 640 | +** separately (by the "shell" command) but we do not want atwait() handlers | |
| 641 | +** being called by separate invocations of fossil_main(). | |
| 642 | +*/ | |
| 643 | +int fossil_main(int argc, char **argv){ | |
| 635 | 644 | const char *zCmdName = "unknown"; |
| 636 | 645 | const CmdOrPage *pCmd = 0; |
| 637 | 646 | int rc; |
| 638 | 647 | |
| 639 | 648 | #if !defined(_WIN32_WCE) |
| 640 | 649 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -630,10 +630,19 @@ | |
| 630 | int _CRT_glob = 0x0001; /* See MinGW bug #2062 */ |
| 631 | #endif |
| 632 | int main(int argc, char **argv) |
| 633 | #endif |
| 634 | { |
| 635 | const char *zCmdName = "unknown"; |
| 636 | const CmdOrPage *pCmd = 0; |
| 637 | int rc; |
| 638 | |
| 639 | #if !defined(_WIN32_WCE) |
| 640 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -630,10 +630,19 @@ | |
| 630 | int _CRT_glob = 0x0001; /* See MinGW bug #2062 */ |
| 631 | #endif |
| 632 | int main(int argc, char **argv) |
| 633 | #endif |
| 634 | { |
| 635 | return fossil_main(argc, argv); |
| 636 | } |
| 637 | |
| 638 | /* All the work of main() is done by a separate procedure "fossil_main()". |
| 639 | ** We have to break this out, because fossil_main() is sometimes called |
| 640 | ** separately (by the "shell" command) but we do not want atwait() handlers |
| 641 | ** being called by separate invocations of fossil_main(). |
| 642 | */ |
| 643 | int fossil_main(int argc, char **argv){ |
| 644 | const char *zCmdName = "unknown"; |
| 645 | const CmdOrPage *pCmd = 0; |
| 646 | int rc; |
| 647 | |
| 648 | #if !defined(_WIN32_WCE) |
| 649 |