Mercurial > hg > Members > kono > os9 > sbc09
changeset 134:42592ea2966f
fix fclose/mfree problem
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 07 Jan 2019 03:38:10 +0900 |
parents | 2562c18c904e |
children | 7503617351c0 |
files | os9/mc09/makefile os9/mc09/mclibos9.c |
diffstat | 2 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/os9/mc09/makefile Sun Jan 06 22:38:04 2019 +0900 +++ b/os9/mc09/makefile Mon Jan 07 03:38:10 2019 +0900 @@ -15,7 +15,7 @@ mc: mc.c cc $(CFLAGS) mc.c -o mc -mc2: mc mc2.c mclib.c +mc2: mc mc2.c mclibos9.c ./mc -s -Mmc mc2.c $(AS09) crtos9.asm -l mc2.lst -o mc2
--- a/os9/mc09/mclibos9.c Sun Jan 06 22:38:04 2019 +0900 +++ b/os9/mc09/mclibos9.c Mon Jan 07 03:38:10 2019 +0900 @@ -35,9 +35,9 @@ char **argv,*p,*q; int argc,n,quote,c; initheap(); - stdin = malloc(sizeof(FILE)*3); initfp(stdin,0); - stdout = (FILE*)(((char*)stdin)+sizeof(FILE)); initfp(stdout,1); - stderr = (FILE*)(((char*)stdout)+sizeof(FILE)); initfp(stderr,2); + stdin = (FILE*) malloc(sizeof(FILE)); initfp(stdin,0); + stdout = (FILE*) malloc(sizeof(FILE)); initfp(stdout,1); + stderr = (FILE*) malloc(sizeof(FILE)); initfp(stderr,2); for ( i = 3; i < NFILES; i++ ) _fcbtbl[i] = NULL; /* create argv here */ argc = 0; @@ -100,7 +100,7 @@ int fd; { fp->fd = d; - fp->buf = (char*)malloc(BUFSIZ); + fp->buf = (char*)malloc(BUFSIZ+1); fp->ptr = fp->buf; fp->fname = fp->length = fp->fmode = 0; }