From e07d8f4f439b50d2dd8804730dcd8af72f0d41b6 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" <saurik@saurik.com> Date: Sat, 8 Oct 2011 12:37:45 -0700 Subject: [PATCH] Reorganize calls to fopen, for assert safety. --- iomfsetgamma.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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); -- 2.45.2