]> git.dolda2000.com Git - ashd.git/commitdiff
lib: Fixed uncompiled bugs in the funopen path.
authorFredrik Tolf <fredrik@dolda2000.com>
Sun, 2 Mar 2014 09:25:47 +0000 (10:25 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Sun, 2 Mar 2014 09:25:47 +0000 (10:25 +0100)
lib/utils.c

index ed22b429910252a1cc893a2d1d2b8af4ebacf316..e2c85a93d2470bb4965b0c14a07d9c6b39cf1378 100644 (file)
@@ -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"