Ticket #959: fix-for-959.patch

File fix-for-959.patch, 450 bytes (added by sleske, 10 years ago)

Fix for issue #959: Do not call fclose() if fopen() failed

  • navit/bookmarks.c

        bugfix: do not call fclose() if fopen() failed.
        
        Fixes crash if destination.txt is not writable.
    
    a b bookmarks_append_coord(char *file, struct pcoord *c, int count, const char *type 
    698698                        }
    699699                } else
    700700                        fprintf(f,"\n");
     701                fclose(f);
     702        } else {
     703                fprintf(stderr, "Error updating destinations file %s: %s\n", former_destination_file, strerror(errno));
    701704        }
    702         fclose(f);
    703705}
    704706