From 35737971905d2247746bc81e0da851744cc49902 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Sun, 2 Mar 2014 10:25:47 +0100 Subject: [PATCH] lib: Fixed uncompiled bugs in the funopen path. --- lib/utils.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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" -- 2.11.0