# Re: May sane_init fail?

Petter Reinholdtsen (pere@hungry.com)
Sun, 11 Apr 1999 23:17:18 +0200

- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: *** Gaetano Paolone ***: "Re: Mustek 1200SP/12000SP Firmware-1.05"
- Previous message: David Mosberger-Tang: "Re: May sane_init fail?"
- Maybe in reply to: Petter Reinholdtsen: "May sane_init fail?"
- Next in thread: Petter Reinholdtsen: "Re: May sane_init fail?"

[David Mosberger-Tang]
> That's fine, but the backend must not rely on not being called
> anymore after returning a status other than SANE_STATUS_GOOD in
> sane_init().

Why? I would expect if sane_init() failed, the backend is in a
undefined state (say it ran out of memory allocating internal buffers,
and should not be used. It will require some rewriting, but I beleave
it is the correct way to behave.

4.3.1 (sane_init) in the documentation should be changed.

"The behaviour of a SANE backend is undefined if this function is
not called first."

Should be changed to read something like.

"The behaviour of a SANE backend is undefined if this function is
not called first, or if the returned status is anything other then
SANE_STATUS_GOOD."

If this is not the case, all backends where sane_init may fail must be
changed with a test in every method to check if sane_init was
successfull.

    --
    ##>  Petter Reinholdtsen <##    | pere@td.org.uit.no
     O-  <SCRIPT Language="Javascript">window.close()</SCRIPT>
    http://www.hungry.com/~pere/    | Go Mozilla, go! Go!

    --
    Source code, list archive, and docs: http://www.mostang.com/sane/
    To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com

     Next message: *** Gaetano Paolone ***: "Re: Mustek 1200SP/12000SP Firmware-1.05"
     Previous message: David Mosberger-Tang: "Re: May sane_init fail?"
     Maybe in reply to: Petter Reinholdtsen: "May sane_init fail?"

     Next in thread: Petter Reinholdtsen: "Re: May sane_init fail?"