Complete.Org: Mailing Lists: Archives: freeciv-dev: August 1999:
Re: [Freeciv-Dev] gtk-client logfile problem; was: New bug at latest CVS
Home

Re: [Freeciv-Dev] gtk-client logfile problem; was: New bug at latest CVS

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Freeciv-Dev] gtk-client logfile problem; was: New bug at latest CVS. (PR#103)
From: dwp@xxxxxxxxxxxxxx
Date: Mon, 9 Aug 1999 19:07:33 -0700 (PDT)

This is a multi-part message in MIME format.

--_----------=_93425265010100
Content-Disposition: inline
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Lindqvist Marko <caz@xxxxxxxxxxxxxxxx> wrote:

>  This bug have appeared since last thursday.
> 
>  GTK-client crashes when server shuts down.
> With my amiga it says:
>  "couldn't open logfile:<some random characters> for appending."
> 
> It doesn't matter if I have actually enabled logging or not.

Yes, the new option processing code broke logging in the gtk
client.  Notes:
- first arg to log_init() should be NULL for no logfile, not 
  the empty string "".
- non-NULL first arg to log_init() should be a static or malloc'ed 
  memory, not automatic.  (Though arguably log_init() should do the 
  strdup itself for this, and keep track of its own allocations.)

Regards,
-- David

--_----------=_93425265010100
Content-Disposition: inline; filename="gtk_log.diff"
Content-Type: text/plain; name="gtk_log.diff"
Content-Transfer-Encoding: 7bit

diff -u -r --exclude-from exclude freeciv-cvs/client/gui-gtk/gui_main.c 
freeciv-mod/client/gui-gtk/gui_main.c
--- freeciv-cvs/client/gui-gtk/gui_main.c       Mon Aug  9 21:16:36 1999
+++ freeciv-mod/client/gui-gtk/gui_main.c       Tue Aug 10 12:34:27 1999
@@ -32,6 +32,7 @@
 #include "log.h"
 #include "game.h"
 #include "map.h"
+#include "mem.h"
 #include "shared.h"
 #include "version.h"
 
@@ -182,7 +183,7 @@
 **************************************************************************/
 static void parse_options(int argc, char **argv)
 {
-  char logfile[512]="";
+  char *logfile = NULL;
   char *option=NULL; /* really use as a pointer */
   int loglevel;
   int i;
@@ -221,7 +222,7 @@
       exit(0);
       }
     else if ((option = get_option("--log",argv,&i,argc)) != NULL)
-      strcpy(logfile,option);
+      logfile = mystrdup(option); /* never free()d */
     else if ((option = get_option("--name",argv,&i,argc)) != NULL)
       strcpy(name, option);
     else if ((option = get_option("--port",argv,&i,argc)) != NULL)

--_----------=_93425265010100--



[Prev in Thread] Current Thread [Next in Thread]
  • Re: [Freeciv-Dev] gtk-client logfile problem; was: New bug at latest CVS. (PR#103), dwp <=