platform_unix.c
changeset 63 10011b12af93
parent 59 9bfe24a8dd3b
child 64 8f4e25f1ceb5
equal deleted inserted replaced
59:9bfe24a8dd3b 63:10011b12af93
   293     char *mem = NULL;
   293     char *mem = NULL;
   294     char *ptr;
   294     char *ptr;
   295     long fsize;
   295     long fsize;
   296     int retval = 0;
   296     int retval = 0;
   297     FILE *io = NULL;
   297     FILE *io = NULL;
       
   298     int knowver = 0;
   298 
   299 
   299     if ( !get_file_size(fname, &fsize) ) goto parse_info_plist_bailed;
   300     if ( !get_file_size(fname, &fsize) ) goto parse_info_plist_bailed;
   300     if ( (mem = malloc(fsize + 1)) == NULL ) goto parse_info_plist_bailed;
   301     if ( (mem = malloc(fsize + 1)) == NULL ) goto parse_info_plist_bailed;
   301     if ( (io = fopen(fname, "r")) == NULL ) goto parse_info_plist_bailed;
   302     if ( (io = fopen(fname, "r")) == NULL ) goto parse_info_plist_bailed;
   302     if ( (fread(mem, fsize, 1, io)) != 1 ) goto parse_info_plist_bailed;
   303     if ( (fread(mem, fsize, 1, io)) != 1 ) goto parse_info_plist_bailed;
   323     fclose(io);
   324     fclose(io);
   324 
   325 
   325     ptr = find_info_plist_version(mem);
   326     ptr = find_info_plist_version(mem);
   326     if (ptr != NULL)
   327     if (ptr != NULL)
   327     {
   328     {
       
   329         knowver = 1;
   328         retval = version_ok(ptr, version);
   330         retval = version_ok(ptr, version);
   329         if (retval == -1)
   331         if (retval == -1)
   330             _fatal("You seem to be all patched up already!");
   332             _fatal("You seem to be all patched up already!");
   331         else if (retval == 0)
   333         else if (retval == 0)
   332         {
   334         {
   338 parse_info_plist_bailed:
   340 parse_info_plist_bailed:
   339     free(mem);
   341     free(mem);
   340     if (io != NULL)
   342     if (io != NULL)
   341         fclose(io);
   343         fclose(io);
   342 
   344 
   343     if (retval == 0) _fatal("Can't determine product's installed version.");
   345     if (!knowver) _fatal("Can't determine product's installed version.");
   344     return(retval);
   346     return(retval);
   345 } /* parse_info_dot_plist */
   347 } /* parse_info_dot_plist */
   346 
   348 
   347 
   349 
   348 int update_version(const char *ver)
   350 int update_version(const char *ver)