From: Fredrik Tolf Date: Sun, 2 Mar 2014 09:25:47 +0000 (+0100) Subject: lib: Fixed uncompiled bugs in the funopen path. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=35737971905d2247746bc81e0da851744cc49902;p=ashd.git lib: Fixed uncompiled bugs in the funopen path. --- 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"