[GRASS5] d.vect: new segfault

Markus Neteler neteler at itc.it
Wed Dec 15 03:48:31 EST 2004


Florian,

I had to make the following change to d.vect to get
it compiled on RH7/gcc 2.9x. It complained about the
position of the declaration.

Unfortunately d.vect no longer works on RHEL 3... Sigh.

d.vect help
Segmentation fault

GRASS 5.7.cvs:~ > gdb `which d.vect `
GNU gdb Red Hat Linux (6.1post-1.20040607.17rh)
(gdb) r help
Starting program: /hardmnt/thuille0/ssi/software/cvsgrass57/dist.i686-pc-linux-gnu/bin/d.vect help

Program received signal SIGSEGV, Segmentation fault.
0x00373049 in _int_free () from /lib/tls/libc.so.6
(gdb) bt
#0  0x00373049 in _int_free () from /lib/tls/libc.so.6
#1  0x00373794 in _int_realloc () from /lib/tls/libc.so.6
#2  0x00372136 in realloc () from /lib/tls/libc.so.6
#3  0x00279d0b in G_realloc (buf=0x92e86c8, n=412) at alloc.c:87
#4  0x0804c525 in icon_files () at main.c:83
#5  0x0804c727 in main (argc=2, argv=0xbfff8014) at main.c:167

nl main.c | head -110 | tail -3
    82
    83          closedir(dir_i);
    84          closedir(dir);

I'm lost again...

Markus

On Wed, Dec 15, 2004 at 09:37:23AM +0100, grass at intevation.de wrote:
> Author: markus
> 
> Update of /grassrepository/grass51/display/d.vect
> In directory doto:/tmp/cvs-serv20407
> 
> Modified Files:
> 	main.c 
> Log Message:
> fixed declaration position for gcc < 3.x
> 
> Index: main.c
> ===================================================================
> RCS file: /grassrepository/grass51/display/d.vect/main.c,v
> retrieving revision 1.45
> retrieving revision 1.46
> diff -u -d -r1.45 -r1.46
> --- main.c	14 Dec 2004 20:43:40 -0000	1.45
> +++ main.c	15 Dec 2004 08:37:21 -0000	1.46
> @@ -57,6 +57,10 @@
>  		for (;;) { /*loop over each directory in etc/symbols*/
>  		
>  		  struct dirent *di = readdir(dir_i);
> +                  int ni = 0;
> +                  char *buf = NULL;
> +                  char *buf2 = NULL;
> +                  char *buf3 = NULL;
>  
>  		  if (!di)
>  			break;
> @@ -64,10 +68,6 @@
>  		  if (di->d_name[0] == '.')
>  		    continue;
>        
> -		  int ni = 0;
> -		  char *buf = NULL;
> -		  char *buf2 = NULL;
> -		  char *buf3 = NULL;
>  		  ni = strlen(di->d_name);
>  		  buf = G_realloc(buf,(strlen(d->d_name) + ni + 1));
>  		  buf2 = G_realloc(buf2,strlen(d->d_name));




More information about the grass-dev mailing list