Fossil SCM
Always call Tcl_FindExecutable, even when the command line arguments are invalid.
Commit
a7392129c060e1d365924b98e36658c08f405163
Parent
b04d5ab4af33e31…
1 file changed
+4
-2
+4
-2
| --- src/th_tcl.c | ||
| +++ src/th_tcl.c | ||
| @@ -437,10 +437,11 @@ | ||
| 437 | 437 | void *pContext |
| 438 | 438 | ){ |
| 439 | 439 | struct TclContext *tclContext = (struct TclContext *)pContext; |
| 440 | 440 | int argc; |
| 441 | 441 | char **argv; |
| 442 | + char *argv0 = 0; | |
| 442 | 443 | Tcl_Interp *tclInterp; |
| 443 | 444 | |
| 444 | 445 | if ( !tclContext ){ |
| 445 | 446 | Th_ErrorMessage(interp, |
| 446 | 447 | "Invalid Tcl context", (const char *)"", 0); |
| @@ -449,13 +450,14 @@ | ||
| 449 | 450 | if ( tclContext->interp ){ |
| 450 | 451 | return TH_OK; |
| 451 | 452 | } |
| 452 | 453 | argc = tclContext->argc; |
| 453 | 454 | argv = tclContext->argv; |
| 454 | - if ( argc>0 && argv ) { | |
| 455 | - Tcl_FindExecutable(argv[0]); | |
| 455 | + if( argc>0 && argv ){ | |
| 456 | + argv0 = argv[0]; | |
| 456 | 457 | } |
| 458 | + Tcl_FindExecutable(argv0); | |
| 457 | 459 | tclInterp = tclContext->interp = Tcl_CreateInterp(); |
| 458 | 460 | if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){ |
| 459 | 461 | Th_ErrorMessage(interp, |
| 460 | 462 | "Could not create Tcl interpreter", (const char *)"", 0); |
| 461 | 463 | return TH_ERROR; |
| 462 | 464 |
| --- src/th_tcl.c | |
| +++ src/th_tcl.c | |
| @@ -437,10 +437,11 @@ | |
| 437 | void *pContext |
| 438 | ){ |
| 439 | struct TclContext *tclContext = (struct TclContext *)pContext; |
| 440 | int argc; |
| 441 | char **argv; |
| 442 | Tcl_Interp *tclInterp; |
| 443 | |
| 444 | if ( !tclContext ){ |
| 445 | Th_ErrorMessage(interp, |
| 446 | "Invalid Tcl context", (const char *)"", 0); |
| @@ -449,13 +450,14 @@ | |
| 449 | if ( tclContext->interp ){ |
| 450 | return TH_OK; |
| 451 | } |
| 452 | argc = tclContext->argc; |
| 453 | argv = tclContext->argv; |
| 454 | if ( argc>0 && argv ) { |
| 455 | Tcl_FindExecutable(argv[0]); |
| 456 | } |
| 457 | tclInterp = tclContext->interp = Tcl_CreateInterp(); |
| 458 | if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){ |
| 459 | Th_ErrorMessage(interp, |
| 460 | "Could not create Tcl interpreter", (const char *)"", 0); |
| 461 | return TH_ERROR; |
| 462 |
| --- src/th_tcl.c | |
| +++ src/th_tcl.c | |
| @@ -437,10 +437,11 @@ | |
| 437 | void *pContext |
| 438 | ){ |
| 439 | struct TclContext *tclContext = (struct TclContext *)pContext; |
| 440 | int argc; |
| 441 | char **argv; |
| 442 | char *argv0 = 0; |
| 443 | Tcl_Interp *tclInterp; |
| 444 | |
| 445 | if ( !tclContext ){ |
| 446 | Th_ErrorMessage(interp, |
| 447 | "Invalid Tcl context", (const char *)"", 0); |
| @@ -449,13 +450,14 @@ | |
| 450 | if ( tclContext->interp ){ |
| 451 | return TH_OK; |
| 452 | } |
| 453 | argc = tclContext->argc; |
| 454 | argv = tclContext->argv; |
| 455 | if( argc>0 && argv ){ |
| 456 | argv0 = argv[0]; |
| 457 | } |
| 458 | Tcl_FindExecutable(argv0); |
| 459 | tclInterp = tclContext->interp = Tcl_CreateInterp(); |
| 460 | if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){ |
| 461 | Th_ErrorMessage(interp, |
| 462 | "Could not create Tcl interpreter", (const char *)"", 0); |
| 463 | return TH_ERROR; |
| 464 |