Fix book creation
authorH.G. Muller <h.g.muller@hccnet.nl>
Fri, 5 Jul 2013 16:32:46 +0000 (18:32 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Fri, 5 Jul 2013 16:32:46 +0000 (18:32 +0200)
Due to duplicate use of the same file pointer variable the game file would be
closed before any games were read from it.

backend.c

index 6d243d7..ca486ef 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -15253,7 +15253,7 @@ void
 CreateBookEvent ()
 {
     ListGame * lg = (ListGame *) gameList.head;
-    FILE *f;
+    FILE *f, *g;
     int nItem;
     static int secondTime = FALSE;
 
@@ -15262,8 +15262,8 @@ CreateBookEvent ()
         return;
     }
 
-    if(!secondTime && (f = fopen(appData.polyglotBook, "r"))) {
-        fclose(f);
+    if(!secondTime && (g = fopen(appData.polyglotBook, "r"))) {
+        fclose(g);
        secondTime++;
        DisplayNote(_("Book file exists! Try again for overwrite."));
        return;