[sane-devel] Do not use exit() in backends

Peter Fales psfales@lucent.com
Thu, 17 Jan 2002 22:03:34 -0600


I've corrected this for the gphoto2 backend.

Pete Fales

On Thu, Jan 17, 2002 at 07:33:42PM +0100, Henning Meier-Geinitz wrote:
> Hi,
> 
> Just to make sure all backend authors read the info covered in the gphoto2
> thread:
> 
> Do not use exit() and similar functions (e.g. abort()) in backends. This will
> effectively kill the frontend and stop the normal SANE way of doing things. So
> no other scanners can be selected. Other scanners can't be closed properly
> (because sane_close and sane_exit can't be called).
> 
> Just use return() to leave the current function and set an appropriate
> SANE_Status code on error.
> 
> It's ok to use _exit() to leave a forked process.
> 
> >From a quick grep I found the following backends use exit():
> 
> * avision.c
> * tamarack.c
> * v4l.c (in v4l-grab.h, doesn't seem to be used, however)
> * gphoto2.c
> 
> Other files that contain exit():
> 
> * /sanei/sanei_pio.c
> 
> 
> Bye,
>   Henning
> 
> 
> _______________________________________________
> Sane-devel mailing list
> Sane-devel@www.mostang.com
> http://www.mostang.com/mailman/listinfo/sane-devel