[Xastir] Can't write objects...
Curt Mills
archer at eskimo.com
Mon Nov 15 23:56:26 EST 2004
On Mon, 15 Nov 2004, Reuven Z Gevaryahu wrote:
> Mike Markowski wrote:
>
> > if (fprintf(f,"%s",out_string) < (int)strlen(out_string)) {
> > // Failed to write
> > fprintf(stderr,"Couldn't write objects to map index file: %s\n",
> > MAP_INDEX_DATA);
> > //current = NULL; // All done
> > }
>
> > current = current->next;
>
> I can't speak for the printf problem, but doing "current = NULL" then
> "current = current->next" will cause a null pointer dereference, and
> hence a segfault. There should probably be a "continue;" after the
> "current = NULL", but I'll defer to Curt who wrote this code IIRC.
Thanks for pointing that out. I looked at the code again. The
intent was to stop the loop if there was a problem, but as you
pointed out the end result is a segfault.
Add a "if (current != NULL)" before the "current = current->next;"
and all is well. Except of course that he still has a problem on
his particular systems. At least it'll keep running.
I just committed that change to CVS.
--
Curt, WE7U. archer at eskimo dot com
http://www.eskimo.com/~archer
Lotto: A tax on people who are bad at math. - unknown
Windows: Microsoft's tax on computer illiterates. - WE7U.
The world DOES revolve around me: I picked the coordinate system!"
More information about the Xastir
mailing list