From: sof Date: Wed, 10 Oct 2001 17:25:15 +0000 (+0000) Subject: [project @ 2001-10-10 17:25:15 by sof] X-Git-Tag: Approximately_9120_patches~852 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=46e2142443c0f190884c3360fa921be898a6b9e3;p=ghc-hetmet.git [project @ 2001-10-10 17:25:15 by sof] - fixed awfully bad bug in allocation of new argv vector, it did: malloc(sizeof(char) * (argc + 1 + 1)); where it should have done: malloc(sizeof(char*) * (argc + 1 + 1)); [ This one is the cause of one or two 5.02 bug reports that are now starting to trickle in. As a stopgap measure (and since I'm to blame for this one, really), I've put up a replacement ghci.exe wrapper at http://www.galconn.com/~sof/ghci.zip ] - added some (currently disabled) debug print code. --- diff --git a/ghc/driver/ghci/ghci.c b/ghc/driver/ghci/ghci.c index 723b767..1ba20dd 100644 --- a/ghc/driver/ghci/ghci.c +++ b/ghc/driver/ghci/ghci.c @@ -1,6 +1,6 @@ /* * - * $Id: ghci.c,v 1.3 2001/08/02 01:01:46 sof Exp $ + * $Id: ghci.c,v 1.4 2001/10/10 17:25:15 sof Exp $ * * ghci wrapper - invokes ghc.exe with the added command-line * option "--interactive". @@ -79,7 +79,7 @@ main(int argc, char** argv) return 1; } - new_argv = (char**)malloc(sizeof(char) * (argc + 1 + 1)); + new_argv = (char**)malloc(sizeof(char*) * (argc + 1 + 1)); if (new_argv == NULL) { errmsg("failed to start up ghc.exe"); return 1; @@ -95,7 +95,7 @@ main(int argc, char** argv) } for ( i=1; i < argc; i++ ) { - new_argv[i+1] = (char*)malloc(sizeof(char) * (strlen(argv[i] + 1))); + new_argv[i+1] = (char*)malloc(sizeof(char) * (strlen(argv[i]) + 1)); if (new_argv[i+1] == NULL) { errmsg("failed to start up ghc.exe"); return 1; @@ -116,5 +116,13 @@ main(int argc, char** argv) ==> Just use spawnv(). */ +#if 0 + fprintf(stderr, "Invoking ghc: "); + i=0; + while (new_argv[i] != NULL) { + fprintf(stderr, "%s ", new_argv[i++]); + } + fprintf(stderr, "\n"); fflush(stderr); +#endif return _spawnv(_P_WAIT, binPath, new_argv); }