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

Henning Meier-Geinitz henning@meier-geinitz.de
Thu, 17 Jan 2002 19:33:42 +0100


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():
Status: O

* 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