[postgis-users] importing shape files nightmare!

strk at refractions.net strk at refractions.net
Fri Sep 16 05:50:28 PDT 2005


Actually, the patch would not be enough to avoid segfault
due to NULL returns from SHPReadObject.
Also, older revision would segfault as well in that case ...
Best help you can give us is providing test data, possibly
a portion of the original ones.

--strk;

On Fri, Sep 16, 2005 at 02:10:24PM +0200, strk at refractions.net wrote:
> Christo, would you try applying the following patch
> to shp2pgsql.c from 1.0.4 ? It would be very helpful ...
> 
> --strk(patch_follows);
> 
> Index: shp2pgsql.c
> ===================================================================
> RCS file: /home/cvs/postgis/postgis/loader/shp2pgsql.c,v
> retrieving revision 1.88.2.7
> diff -U2 -r1.88.2.7 shp2pgsql.c
> --- shp2pgsql.c 29 Aug 2005 22:36:14 -0000      1.88.2.7
> +++ shp2pgsql.c 16 Sep 2005 12:08:20 -0000
> @@ -450,9 +450,12 @@
>         {
>                 obj = SHPReadObject(hSHPHandle,j);
> -               if ( obj && obj->nVertices > 0 ) {
> +               if ( obj )
> +               {
> +                       if ( obj->nVertices > 0 ) {
> +                               SHPDestroyObject(obj);
> +                               break;
> +                       }
>                         SHPDestroyObject(obj);
> -                       break;
>                 }
> -               SHPDestroyObject(obj);
>                 obj=NULL;
>         }
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list