Fossil SCM

Fix the "shell" command so that it avoids invoking the atexit() handler more than once.

drh 2019-08-21 16:55 trunk
Commit 07a5a2118e23760ea090d7b9fed3aa48b54f1bf857a22baf56e019e274bcb3c4
2 files changed +1 -1 +9
+1 -1
--- src/fshell.c
+++ src/fshell.c
@@ -109,11 +109,11 @@
109109
continue;
110110
}
111111
if( childPid==0 ){
112112
/* This is the child process */
113113
int main(int, char**);
114
- main(nArg, azArg);
114
+ fossil_main(nArg, azArg);
115115
exit(0);
116116
}else{
117117
/* The parent process */
118118
int status;
119119
waitpid(childPid, &status, 0);
120120
--- 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 @@
630630
int _CRT_glob = 0x0001; /* See MinGW bug #2062 */
631631
#endif
632632
int main(int argc, char **argv)
633633
#endif
634634
{
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){
635644
const char *zCmdName = "unknown";
636645
const CmdOrPage *pCmd = 0;
637646
int rc;
638647
639648
#if !defined(_WIN32_WCE)
640649
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button