Hi,
2013/2/3 <svn_grass@osgeo.org>:
Author: mmetz
Date: 2013-02-03 08:06:21 -0800 (Sun, 03 Feb 2013)
New Revision: 54874
Modified:
grass/trunk/vector/v.in.ogr/main.c
Log:
v.in.ogr: fix r54872 for linux
[...]
len = strlen("SHAPE_ENCODING") + strlen(param.encoding->answer) + 2;
- buf = G_malloc(len * sizeof(char));
+ encbuf = G_malloc(len * sizeof(char));
/* -> Esri Shapefile */
- sprintf(buf, "SHAPE_ENCODING=%s", param.encoding->answer);
- putenv(buf);
+ sprintf(encbuf, "SHAPE_ENCODING=%s", param.encoding->answer);
+ encp = G_store(encbuf);
+ putenv(encp);
any reason why not use G_asprintf() ? Martin
--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa
On Sun, Feb 3, 2013 at 5:08 PM, Martin Landa <landa.martin@gmail.com> wrote:
Hi,
2013/2/3 <svn_grass@osgeo.org>:
Author: mmetz
Date: 2013-02-03 08:06:21 -0800 (Sun, 03 Feb 2013)
New Revision: 54874
Modified:
grass/trunk/vector/v.in.ogr/main.c
Log:
v.in.ogr: fix r54872 for linux
[...]
len = strlen("SHAPE_ENCODING") + strlen(param.encoding->answer) + 2;
- buf = G_malloc(len * sizeof(char));
+ encbuf = G_malloc(len * sizeof(char));
/* -> Esri Shapefile */
- sprintf(buf, "SHAPE_ENCODING=%s", param.encoding->answer);
- putenv(buf);
+ sprintf(encbuf, "SHAPE_ENCODING=%s", param.encoding->answer);
+ encp = G_store(encbuf);
+ putenv(encp);
any reason why not use G_asprintf() ? Martin
Because of a suspected bug, see
http://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/asprintf.c#L52
Also compare G_vasprintf() to G_rasprintf() and man vsnprintf
Markus M
--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa