[GRASS-dev] Re: [GRASS GIS] #1598: Exit call in some libs
GRASS GIS
trac at osgeo.org
Mon Mar 5 15:36:23 EST 2012
#1598: Exit call in some libs
-------------------------+--------------------------------------------------
Reporter: volter | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Default | Version: 6.4.2
Keywords: shared lib | Platform: Unspecified
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by glynn):
Replying to [ticket:1598 volter]:
> Some of the Grass libraries call exit. Probably you can do something
about it!
The standard error-handling mechanism in GRASS is to call G_fatal_error(),
which calls exit(). Most other libraries probably shouldn't be calling
exit() directly, but should be calling G_fatal_error() instead.
FWIW, the list of library files which call exit() directly is:
{{{
lib/linkm/oom.c
lib/iostream/ami_stream.cpp
lib/vector/diglib/allocation.c
lib/db/dbmi_driver/driver.c
lib/form/open.c
lib/raster3d/maskfn.c
lib/rst/data/dataquad.c
lib/gis/parser_help.c
lib/gis/error.c
lib/gis/parser.c
lib/gis/gisinit.c
lib/driver/init.c
}}}
plus most of the CDHC library.
libgrass_sqlp's exit() is from yy_fatal_error(), which is part of the lex
boilerplate. If desired, error handling can be customised by defining the
macro YY_FATAL_ERROR.
Some of the above are legitimate, others may indicate code which should be
calling G_fatal_error() instead.
lib/vector/diglib/allocation.c uses G_calloc(), so it doesn't need to
perform its own error handling (although dig__frealloc() should just use
G_realloc()).
The other cases should be examined, but most of these are invalid/wontfix.
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1598#comment:1>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list