Minor bug in scheme-script.c: the new argv should be

null-terminated.
This commit is contained in:
Abdulaziz Ghuloum 2007-11-30 07:41:56 -05:00
parent 6386b3420a
commit 33d04c8d1e
1 changed files with 2 additions and 1 deletions

View File

@ -23,7 +23,7 @@
int main(int argc, char** argv){ int main(int argc, char** argv){
if(argc >= 2){ if(argc >= 2){
char** a = calloc(argc+1, sizeof(char*)); char** a = calloc(argc+2, sizeof(char*));
if(! a) { if(! a) {
fprintf(stderr, "Error in scheme-script: cannot calloc\n"); fprintf(stderr, "Error in scheme-script: cannot calloc\n");
exit(-1); exit(-1);
@ -34,6 +34,7 @@ int main(int argc, char** argv){
for(i=1; i<argc; i++){ for(i=1; i<argc; i++){
a[i+1] = argv[i]; a[i+1] = argv[i];
} }
a[argc+1] = 0;
int rv = execv(EXEFILE, a); int rv = execv(EXEFILE, a);
fprintf(stderr, "Error executing ikarus from scheme-script: %s\n", fprintf(stderr, "Error executing ikarus from scheme-script: %s\n",
strerror(errno)); strerror(errno));