X-Git-Url: http://www.dolda2000.com/gitweb/?p=ashd.git;a=blobdiff_plain;f=lib%2Futils.c;h=e2c85a93d2470bb4965b0c14a07d9c6b39cf1378;hp=ed22b429910252a1cc893a2d1d2b8af4ebacf316;hb=35737971905d2247746bc81e0da851744cc49902;hpb=2b8eb6dfb02dc93372c5e0a4efa6dff73a8ba004 diff --git a/lib/utils.c b/lib/utils.c index ed22b42..e2c85a9 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -518,6 +518,8 @@ static int wrapclose(void *pdata) if(nf->close != NULL) ret = nf->close(nf->pdata); + else + ret = 0; free(nf); return(ret); } @@ -581,6 +583,8 @@ static int wrapclose(void *pdata) if(nf->close != NULL) ret = nf->close(nf->pdata); + else + ret = 0; free(nf); return(ret); } @@ -594,7 +598,8 @@ FILE *funstdio(void *pdata, struct stdif *nf; omalloc(nf); - return(funopen(pdata, read?wrapread:NULL, write:wrapwrite:NULL, seek:wrapseek:NULL, wrapclose)); + *nf = (struct stdif){.read = read, .write = write, .seek = seek, .close = close, .pdata = pdata}; + return(funopen(nf, read?wrapread:NULL, write?wrapwrite:NULL, seek?wrapseek:NULL, wrapclose)); } #else #error "No stdio implementation for this system"