bug in saned...

From: Jochen Eisinger (jochen.eisinger@gno.de)
Date: Wed Jun 28 2000 - 13:39:34 PDT

  • Next message: Oliver Rauch: "Re: scsi command queuing"

    Hi,

    I've send this eMail to sane-devel some days ago, but somehow, it never
    appeared... so I'm trying again...

    -- jochen

    > orig mail:

    Hi,

    I've found a bug in SANED. When you're scanning and you want to cancel
    the scan the net backend invokes SANE_NET_CANCEL. saned then calls
    sane_cancel and returns SANE_STATUS_OK. Then net.c closes the data_fd
    and saned continues with do_scan. If there is still image data in the
    saned buffer, it tries to write to the data_fd and receives a SIGPIPE
    and exits... and net.c crashes.

    I avoid this by
    a) adding a field "u_int docancel : 1;" to struct Handle.

    b) In process_request I add to SANE_NET_CANCEL "handle[h].docancel = 1;"

    c) and at the and of do_scan where process_request is called I add "if
    (handle[h].docancel) break;" and to the line handle[h].scanning=0; I add
    "handle[h].docancel=0;".

    d) in start_scan I add at the end to the line handle[h].scanning = 1;
    the line
    "handle[h].docancel=0;"

    e) again in process_request I add to SANE_NET_START after the line
    handle[h].scanning=0 the line "handle[h].docancel=0".

    Now the saned doesn't try to write to the closed pipe and net.c doesn't
    crash anymore.

    -- jochen

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



    This archive was generated by hypermail 2b29 : Wed Jun 28 2000 - 13:39:42 PDT