[GRASS5] gis lib: write error function (put_row.c)

Glynn Clements glynn.clements at virgin.net
Tue Oct 22 18:37:29 EDT 2002


Gordon Keith wrote:

> > while having the problem that a disk run out of space
> > while using r.in.gdal, I found that
> >
> > write_error()
> > in src/libes/gis/put_row.c
> > just contains G_warning() and not G_fatal_error().
> >
> > Are there objections to change this to
> > G_fatal_error("...unable to write row...")
> > ?
> >
> > It doesn't make much sense to continue writing to a full disk.
> 
> BUT, you can't clean up after G_fatal_error.

You can install a handler with G_set_error_routine(). If the handler
returns, then exit() will be called; however, you can use
setjmp/longmp to return control to the application.

> If you run out of disk space the first thing you want to do is delete 
> temporary raster files. If you call G_fatal_error the temporary file is 
> left in place, aggrevating the problem.

Then handle fatal errors. Or, where possible, delete the file as soon
as it has been opened.

However, G_fatal_error() should probably try harder to clean up;
although we would probably need e.g. G_really_fatal_error() for
situations which are so bad that cleanup should not be attempted (if
memory is corrupted, you don't want to do anything dangerous like
deleting files, in case the filenames have been corrupted).

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list