From: Jay Freeman (saurik) Date: Sat, 8 Oct 2011 19:37:45 +0000 (-0700) Subject: Reorganize calls to fopen, for assert safety. X-Git-Tag: v1.1.1~4 X-Git-Url: https://git.saurik.com/uikittools.git/commitdiff_plain/e07d8f4f439b50d2dd8804730dcd8af72f0d41b6 Reorganize calls to fopen, for assert safety. --- diff --git a/iomfsetgamma.c b/iomfsetgamma.c index 8f02a4c..71159d5 100644 --- a/iomfsetgamma.c +++ b/iomfsetgamma.c @@ -75,18 +75,19 @@ int main(int argc, char *argv[]) { FILE *file = fopen("/tmp/.iomfgamma.dat", "r"); if (file == NULL) { - file = fopen("/tmp/.iomfgamma.dat", "wb"); - $IOMobileFramebufferGetGammaTable = dlsym(RTLD_DEFAULT, "IOMobileFramebufferGetGammaTable"); - _assert($IOMobileFramebufferGetGammaTable != NULL); error = $IOMobileFramebufferGetGammaTable(fb, data); _assert(error == 0); + file = fopen("/tmp/.iomfgamma.dat", "wb"); + _assert(file != NULL); + fwrite(data, 1, sizeof(data), file); fclose(file); file = fopen("/tmp/.iomfgamma.dat", "r"); + _assert(file != NULL); } fread(data, 1, sizeof(data), file);