Re: bug in saned

From: Jochen Eisinger (jochen.eisinger@gno.de)
Date: Fri Jun 30 2000 - 14:23:46 PDT

  • Next message: Joachim Ansorg: "Re: Problems with mustek scanner"

    Hi,

    > Why where SIGPIPE not catched in the first place? Do you have a
    > patch? Could this bug be related to the problem people reports when
    > running a net scanner on localhost?

    Sorry, I don't really understand what you mean by "catched in the first
    place"... saned has a sighandler installed for sigpipe and this handler
    is callen (if you start saned with -d128 you can see the signo) and
    saned exits. the net backend afterwards crashes (because it thinks saned
    is still running...)

    I've attached a patch against the saned.c from the 1.0.2 distribution...

    -- jochen

    --- frontend/saned.c Sun Mar 5 14:44:45 2000
    +++ saned.c Fri Jun 30 23:18:41 2000
    @@ -100,6 +100,7 @@
       {
         u_int inuse : 1; /* is this handle in use? */
         u_int scanning : 1; /* are we scanning? */
    + u_int docancel : 1; /* cancel the current scan */
         SANE_Handle handle; /* backends handle */
       }
     Handle;
    @@ -524,7 +525,10 @@
     
       reply->status = sane_start (be_handle);
       if (reply->status == SANE_STATUS_GOOD)
    - handle[h].scanning = 1;
    + {
    + handle[h].scanning = 1;
    + handle[h].docancel = 0;
    + }
     
       return fd;
     }
    @@ -674,10 +678,13 @@
             {
               DBG(4, "do_scan: processing RPC request on fd %d\n", w->io.fd);
               process_request (w);
    + if (handle[h].docancel)
    + break;
             }
         }
       while (status == SANE_STATUS_GOOD || bytes_in_buf > 0 || status_dirty);
       DBG(2, "do_scan: done, status=%s\n", sane_strstatus (status));
    + handle[h].docancel = 0;
       handle[h].scanning = 0;
     }
     
    @@ -854,6 +861,7 @@
                   {
                     sane_cancel (handle[h].handle);
                     handle[h].scanning = 0;
    + handle[h].docancel = 0;
                     syslog (LOG_ERR, "process_request: accept failed! (%s)\n",
                             strerror (errno));
                     return;
    @@ -872,6 +880,7 @@
     
             h = decode_handle (w, "cancel");
             sane_cancel (handle[h].handle);
    + handle[h].docancel=1;
             sanei_w_reply (w, (WireCodecFunc) sanei_w_word, &ack);
           }
           break;

    --
    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 : Fri Jun 30 2000 - 14:14:12 PDT