diff -Nur -Xfreeciv/diff_ignore freeciv/client/gui-gtk/chatline.c test-log/client/gui-gtk/chatline.c --- freeciv/client/gui-gtk/chatline.c Fri Nov 30 06:50:36 2001 +++ test-log/client/gui-gtk/chatline.c Mon May 20 23:43:24 2002 @@ -84,14 +84,17 @@ void log_output_window(void) { char *theoutput; - FILE *fp; + FILE *fp = NULL; append_output_window(_("Exporting output window to civgame.log ...")); theoutput = gtk_editable_get_chars(GTK_EDITABLE(main_message_area), 0, -1); - fp = fopen("civgame.log", "w"); /* should allow choice of name? */ - fprintf(fp, "%s", theoutput); - fclose(fp); - append_output_window(_("Export complete.")); + if ((fp = fopen("civgame.log", "w"))) { /* should allow choice of name? */ + fprintf(fp, "%s", theoutput); + fclose(fp); + append_output_window(_("Export complete.")); + } else { + append_output_window(_("Export failed, couldn't write to file")); + } } /************************************************************************** diff -Nur -Xfreeciv/diff_ignore freeciv/client/gui-gtk-2.0/chatline.c test-log/client/gui-gtk-2.0/chatline.c --- freeciv/client/gui-gtk-2.0/chatline.c Mon Mar 11 17:19:24 2002 +++ test-log/client/gui-gtk-2.0/chatline.c Mon May 20 23:43:32 2002 @@ -93,14 +93,18 @@ void log_output_window(void) { char *theoutput; - FILE *fp; + FILE *fp = NULL; append_output_window(_("Exporting output window to civgame.log ...")); theoutput = gtk_editable_get_chars(GTK_EDITABLE(main_message_area), 0, -1); - fp = fopen("civgame.log", "w"); /* should allow choice of name? */ - fprintf(fp, "%s", theoutput); - fclose(fp); - append_output_window(_("Export complete.")); + if ((fp = fopen("civgame.log", "w"))) { /* should allow choice of name? */ + fprintf(fp, "%s", theoutput); + fclose(fp); + append_output_window(_("Export complete.")); + } else { + append_output_window(_("Export failed, couldn't write to file")); + } + } /************************************************************************** diff -Nur -Xfreeciv/diff_ignore freeciv/client/gui-mui/chatline.c test-log/client/gui-mui/chatline.c --- freeciv/client/gui-mui/chatline.c Fri Jan 19 05:18:17 2001 +++ test-log/client/gui-mui/chatline.c Mon May 20 23:43:10 2002 @@ -41,21 +41,21 @@ **************************************************************************/ void log_output_window(void) { - char *str; - int i,entries = xget(main_output_listview, MUIA_NList_Entries); - FILE *fp; + char *str; + int i, entries = xget(main_output_listview, MUIA_NList_Entries); + FILE *fp = NULL; append_output_window(_("Exporting output window to civgame.log ...")); - fp = fopen("civgame.log", "w"); /* should allow choice of name? */ - - for (i=0;i