[GRASS5] Re: [bug #223] (grass) d.zoom segfaults
Edzer J. Pebesma
e.pebesma at geog.uu.nl
Tue Mar 20 12:32:07 EST 2001
Sorry about my previous post -- I intended to send it to Job in
private, but overlooked the Reply-To field. Now I owe you a translation:
spijker at geo.uu.nl wrote:
> The solution (or: my solution) is the following diff for find_file.c. I
> can submit it to the CVS but I don't like to mess with libraries and I
> don't know if there is a 'philosophy' behind the original method.
>
> 54c54,56
> < strcpy(mapset, xmapset);
> ---
> > if (!mapset=="") {
> > strcpy(mapset, xmapset);
> > }
Be careful about comparing mapset directly to ""; please try the
example program below to see why.
A more defensive solution might be:
if (mapset != NULL && *mapset != '\0') {
(it doesn't need to know whether mapset is a character array or a
pointer to a character).
--
Edzer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x.c
Type: text/x-csrc
Size: 262 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20010320/c42ca6ae/x.bin
More information about the grass-dev
mailing list